[Fudaa-svn-commit] SF.net SVN: fudaa:[3906]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <had...@us...> - 2008-09-10 18:55:52
|
Revision: 3906 http://fudaa.svn.sourceforge.net/fudaa/?rev=3906&view=rev Author: hadouxad Date: 2008-09-10 18:55:59 +0000 (Wed, 10 Sep 2008) Log Message: ----------- GRAPHES Wizard graphes temporels OK - Lors Creation des graphe temporels du calque: cela utilise la source du visupanel et non plsu l unique source du projet. - POssibilit?\195?\169 d ajouter les courbes dans les graphes widget deja existant - Possibilit?\195?\169 de cr?\195?\169er un nouveau graphe - fonctionne pour les sondes et liste de points Wizard graphes profils spatiaux OK, fusion marche moyen... - panel 1: choix des isolignes, ne peut pas avancer tant qu il n y a rien de bon de choisi - panel 2 Choix des pas de tems et variables - panel 3 : choix creation ou graphes profils existant, on ne peut avancer tant qu il n y a rien de choisi (graphe existant a jout?\195?\169 ou cocher la case creation)) Fusion de graphes OK moyen (cf listing bugs): - action popup du widget "Fusion avec un autre graphe" - des l appui du bouton sur la popup de la widget selectionne: - ouverture d un menu qui propose la liste des graphes possible a fusionner ensemble (profils spatiaux et temporels s?\195?\169par?\195?\169s) - a la fin suppression de la widget choisie dans le panel. - recupere les variables des 2 graphes et les merge egalement - Fonctionne OK poru les profils spatiaux Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromLine.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.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/TrPostCourbeModel.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/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardCourbeTemporelle.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProfileAction.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardProfilSpatial.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -11,31 +11,27 @@ import java.awt.Component; import java.awt.Graphics; -import com.vividsolutions.jts.algorithm.SIRtreePointInRing; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.LinearRing; - -import com.memoire.fu.Fu; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.gis.GISLib; - import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.ef.operation.EfIndexVisitorHashSetNode; import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestNode; - import org.fudaa.ebli.calque.ZCalquePoint; import org.fudaa.ebli.find.EbliFindActionInterface; import org.fudaa.ebli.find.EbliFindExpressionContainerInterface; import org.fudaa.ebli.geometrie.GrMorphisme; import org.fudaa.ebli.geometrie.GrPoint; - import org.fudaa.fudaa.meshviewer.MvLayerGrid; import org.fudaa.fudaa.meshviewer.model.MvExpressionSupplierNode; import org.fudaa.fudaa.meshviewer.model.MvNodeModel; +import com.memoire.fu.Fu; +import com.memoire.fu.FuLog; +import com.vividsolutions.jts.algorithm.SIRtreePointInRing; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.LinearRing; + /** * @author deniger * @version $Id: MvNodeLayer.java,v 1.27 2007-04-20 16:22:09 deniger Exp $ @@ -123,6 +119,13 @@ return r; } + /** + * Methode qui permet de savoir si un point appartient au layer. + * + * @param _pt + * @param _tolerance + * @return + */ public CtuluListSelection selectionFromIndex(final GrPoint _pt, final int _tolerance) { if (Fu.DEBUG && FuLog.isDebug()) { FuLog.debug("FMV: layer select from index"); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -43,7 +43,6 @@ import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; import org.fudaa.fudaa.sig.FSigLineSingleModel; -import org.fudaa.fudaa.tr.post.TrPostSource; import com.memoire.bu.BuLib; import com.vividsolutions.jts.geom.LineString; @@ -64,17 +63,17 @@ final EfLineIntersectorActivity act_; final MvProfileTarget data_; // BuDesktop dest_; - final ListModel initVar_; + public final ListModel initVar_; GrBoite initZoom_; boolean isZoomChanged_; EfLineIntersectionsResultsMng meshesResults_; - String name_; + public String name_; EfLineIntersectionsResultsMng nodesResults_; final ZEbliCalquesPanel panel_; - LineString selectedLine_; + public LineString selectedLine_; final FudaaCourbeTimeListModel timeModel_; @@ -82,7 +81,7 @@ ZCalqueLigneBrisee tmp_; - final CtuluUI ui_; + public final CtuluUI ui_; public MvProfileBuilder(final MvProfileTarget _data, final CtuluUI _ui, final ZEbliCalquesPanel _panel, EfLineIntersectionsCorrectionTester _tester) { @@ -105,7 +104,13 @@ return res; } - protected void actBuildGroup(final ProgressionInterface _prog, final MvExportChooseVarAndTime _selected) { + /** + * methode qui construit le nouveau graphe de profil spatial. + * + * @param _prog + * @param _selected + */ + public void actBuildGroup(final ProgressionInterface _prog, final MvExportChooseVarAndTime _selected) { int[] time = _selected.getSelectedTimeStepIdx(); final CtuluVariable[] vs = _selected.getSelectedVar(); @@ -237,147 +242,128 @@ * @param _prog * @param _selected */ - public void actAddGroupForExistingModel(final ProgressionInterface _prog, - MvProfileTreeModel _tree, TrPostSource _src) { - - -// int[] time = _selected.getSelectedTimeStepIdx(); - // final CtuluVariable[] vs = _selected.getSelectedVar(); + public MvProfileFillePanel actAddGroupForExistingModel(final ProgressionInterface _prog, + final MvExportChooseVarAndTime _selected) { + int[] time = _selected.getSelectedTimeStepIdx(); + final CtuluVariable[] vs = _selected.getSelectedVar(); - double[] time = _src.getTime().getTimeListModel().getTimesInSec(); - H2dVariableType[] vs = _src.getAllVariablesNonVec(); + final int nbVar = vs == null ? 0 : vs.length; + final boolean isTime = timeModel_ != null; + if (time == null) { + time = new int[] { 0 }; + } + boolean addXYForNode = false; + boolean addXYForMesh = false; + for (int i = initVar_.getSize() - 1; i >= 0; i--) { + if (data_.getData().isElementVar((CtuluVariable) initVar_.getElementAt(i))) { + addXYForMesh = true; + } else { + addXYForNode = true; + } + // les 2 sont a true + if (addXYForMesh && addXYForNode) { + break; + } + } + final int nbTIme = time.length; + final MvProfileTreeModel tree = new MvProfileTreeModel(this.data_, tester_); + if (addXYForNode) { + tree.setNodesResults(getNodeResultsMng(_prog), getNodeResultBuilder(_prog)); + } + if (addXYForMesh) { + tree.setMeshesResults(getMeshResultsMng(_prog), getMeshesResultBuilder(_prog)); - - - - final int nbVar = vs == null ? 0 : vs.length; - final boolean isTime = timeModel_ != null; - - // boolean addXYForNode = false; - // boolean addXYForMesh = false; - // for (int i = initVar_.getSize() - 1; i >= 0; i--) { - // if (data_.getData().isElementVar((CtuluVariable) - // initVar_.getElementAt(i))) { - // addXYForMesh = true; - // } else { - // addXYForNode = true; - // } - // // les 2 sont a true - // if (addXYForMesh && addXYForNode) { - // break; - // } - // } - final int nbTIme = time.length; - final MvProfileTreeModel tree = _tree; - // if (addXYForNode) { - // tree.setNodesResults(getNodeResultsMng(_prog), - // getNodeResultBuilder(_prog)); - // } - // if (addXYForMesh) { - // tree.setMeshesResults(getMeshResultsMng(_prog), - // getMeshesResultBuilder(_prog)); - // - // } - final EGGroup grCoord = new EGGroup(); - final String s = EbliLib.getS("Coordonn\xE9es"); - grCoord.setTitle(s); - final EGAxeVertical yCoordonnees = new EGAxeVertical(); - yCoordonnees.setTitre(s); - yCoordonnees.setUnite("m"); - grCoord.setAxeY(yCoordonnees); - final String sep = " - "; - // if (addXYForNode) { - // final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, - // new MvProfileCoordinatesModel( - // getNodeResultsMng(_prog).getDefaultRes(), true)); - // final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, - // new MvProfileCoordinatesModel( - // getNodeResultsMng(_prog).getDefaultRes(), false)); - // if (addXYForNode && addXYForMesh) { - // courbeChild.setTitle(courbeChild.getTitle() + sep + - // MvResource.getS("Noeuds")); - // courbeChild2.setTitle(courbeChild2.getTitle() + sep + - // MvResource.getS("Noeuds")); - // } - // grCoord.addEGComponent(courbeChild); - // - // grCoord.addEGComponent(courbeChild2); - // - // } - // if (addXYForMesh) { - // final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, - // new MvProfileCoordinatesModel( - // getMeshResultsMng(_prog).getDefaultRes(), true)); - // final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, - // new MvProfileCoordinatesModel( - // getMeshResultsMng(_prog).getDefaultRes(), false)); - // if (addXYForNode && addXYForMesh) { - // courbeChild.setTitle(courbeChild.getTitle() + sep + - // MvResource.getS("Elements")); - // courbeChild2.setTitle(courbeChild2.getTitle() + sep + - // MvResource.getS("Elements")); - // } - // grCoord.addEGComponent(courbeChild); - // - // grCoord.addEGComponent(courbeChild2); - // - // } - grCoord.setVisible(false); - tree.add(grCoord); - // map permettant de stocker la correspondance var -> groupe - final Map varGroup = new HashMap(); - if (vs != null) { - for (int i = 0; i < nbVar; i++) { - // pas null - final CtuluVariable var = vs[i]; - MvProfileCourbeGroup gri = null; - // dans ce cas, on va g\xE9rer les variables parents: inutile de creer des - // groupe different - // pour des variables de meme type - Color c = null; - boolean mustAddGr = true; - if (var instanceof H2dVariableType) { - H2dVariableType parent = ((H2dVariableType) var).getParentVariable(); - if (parent == null) { - parent = (H2dVariableType) var; - } - c = MvProfileFillePanel.getColorFor(i, parent); - gri = (MvProfileCourbeGroup) varGroup.get(parent); - if (gri == null) { - gri = MvProfileFillePanel.createGroupFor(parent); - varGroup.put(parent, gri); - } else { - mustAddGr = false; - } + } + final EGGroup grCoord = new EGGroup(); + final String s = EbliLib.getS("Coordonn\xE9es"); + grCoord.setTitle(s); + final EGAxeVertical yCoordonnees = new EGAxeVertical(); + yCoordonnees.setTitre(s); + yCoordonnees.setUnite("m"); + grCoord.setAxeY(yCoordonnees); + final String sep = " - "; + if (addXYForNode) { + final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( + getNodeResultsMng(_prog).getDefaultRes(), true)); + final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( + getNodeResultsMng(_prog).getDefaultRes(), false)); + if (addXYForNode && addXYForMesh) { + courbeChild.setTitle(courbeChild.getTitle() + sep + MvResource.getS("Noeuds")); + courbeChild2.setTitle(courbeChild2.getTitle() + sep + MvResource.getS("Noeuds")); + } + grCoord.addEGComponent(courbeChild); + + grCoord.addEGComponent(courbeChild2); + + } + if (addXYForMesh) { + final EGCourbeChild courbeChild = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( + getMeshResultsMng(_prog).getDefaultRes(), true)); + final EGCourbeChild courbeChild2 = new MVProfileCourbeCoordinate(grCoord, new MvProfileCoordinatesModel( + getMeshResultsMng(_prog).getDefaultRes(), false)); + if (addXYForNode && addXYForMesh) { + courbeChild.setTitle(courbeChild.getTitle() + sep + MvResource.getS("Elements")); + courbeChild2.setTitle(courbeChild2.getTitle() + sep + MvResource.getS("Elements")); + } + grCoord.addEGComponent(courbeChild); + + grCoord.addEGComponent(courbeChild2); + + } + grCoord.setVisible(false); + tree.add(grCoord); + // map permettant de stocker la correspondance var -> groupe + final Map varGroup = new HashMap(); + if (vs != null) { + for (int i = 0; i < nbVar; i++) { + // pas null + final CtuluVariable var = vs[i]; + MvProfileCourbeGroup gri = null; + // dans ce cas, on va g\xE9rer les variables parents: inutile de creer des groupe different + // pour des variables de meme type + Color c = null; + boolean mustAddGr = true; + if (var instanceof H2dVariableType) { + H2dVariableType parent = ((H2dVariableType) var).getParentVariable(); + if (parent == null) { + parent = (H2dVariableType) var; } + c = MvProfileFillePanel.getColorFor(i, parent); + gri = (MvProfileCourbeGroup) varGroup.get(parent); if (gri == null) { - gri = MvProfileFillePanel.createGroupFor(var); + gri = MvProfileFillePanel.createGroupFor(parent); + varGroup.put(parent, gri); + } else { + mustAddGr = false; } - if (c == null) { - c = MvProfileFillePanel.getColorFor(i, var); + } + if (gri == null) { + gri = MvProfileFillePanel.createGroupFor(var); + } + if (c == null) { + c = MvProfileFillePanel.getColorFor(i, var); + } + // on doit construire les courbes + for (int t = 0; t < nbTIme; t++) { + final MVProfileCourbeModel model = new MVProfileCourbeModel(var, data_.getData(), time[t], getResBuilder(var, + _prog), _prog); + EGCourbeChild child; + if (isTime) { + model.setTitle(var.toString() + CtuluLibString.ESPACE + timeModel_.getElementAt(time[t])); + child = new MvProfileCourbeTime(gri, model, timeModel_); + } else { + child = new MvProfileCourbe(gri, model); } - // on doit construire les courbes - for (int t = 0; t < nbTIme; t++) { - final MVProfileCourbeModel model = new MVProfileCourbeModel(var, data_.getData(), (int) time[t], - getResBuilder(var, - _prog), _prog); - EGCourbeChild child; - if (isTime) { - model.setTitle(var.toString() + CtuluLibString.ESPACE + time[t]); - child = new MvProfileCourbeTime(gri, model, timeModel_); - } else { - child = new MvProfileCourbe(gri, model); - } - child.setAspectContour(c); - gri.addEGComponent(child); - } - if (mustAddGr) { - tree.add(gri); - } + child.setAspectContour(c); + gri.addEGComponent(child); } + if (mustAddGr) { + tree.add(gri); + } } + } - //data_.profilPanelCreated(new MvProfileFillePanel(tree, ui_), _prog, name_); + return new MvProfileFillePanel(tree, ui_); } @@ -410,14 +396,14 @@ return getNodeResultBuilder(_prog); } - protected EfLineIntersectionsResultsI getDefaultRes(final CtuluVariable _o, final ProgressionInterface _prog) { + public EfLineIntersectionsResultsI getDefaultRes(final CtuluVariable _o, final ProgressionInterface _prog) { if (data_.getData().isElementVar(_o)) { return getMeshResultsMng(_prog).getDefaultRes(); } return getNodeResultsMng(_prog).getDefaultRes(); } - protected void showNoIntersectionFound() { + public void showNoIntersectionFound() { BuLib.invokeLater(new Runnable() { public void run() { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromLine.java 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromLine.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -7,24 +7,21 @@ */ package org.fudaa.fudaa.meshviewer.profile; -import com.vividsolutions.jts.geom.LineString; - import org.fudaa.ctulu.CtuluTaskDelegate; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.CtuluVariable; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluLibSwing; - import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.ef.operation.EfLineIntersectionsCorrectionTester; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; - import org.fudaa.ebli.calque.ZEbliCalquesPanel; - import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; +import com.vividsolutions.jts.geom.LineString; + public class MvProfileBuilderFromLine extends MvProfileBuilder { public MvProfileBuilderFromLine(final MvProfileTarget _data, final CtuluUI _ui, final LineString _line, @@ -63,6 +60,8 @@ actFirstTest(task.getStateReceiver()); } }); + + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilderFromTree.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -19,17 +19,6 @@ import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; -import com.vividsolutions.jts.geom.LineString; - -import com.memoire.bu.BuBorders; -import com.memoire.bu.BuGlassPaneStop; -import com.memoire.bu.BuHorizontalLayout; -import com.memoire.bu.BuLabel; -import com.memoire.bu.BuPanel; -import com.memoire.bu.BuRadioButton; -import com.memoire.bu.BuScrollPane; -import com.memoire.bu.BuVerticalLayout; - import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluTaskDelegate; @@ -38,31 +27,59 @@ import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; - import org.fudaa.dodico.ef.operation.EfLineIntersectionsCorrectionTester; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; - import org.fudaa.ebli.calque.ZCalqueLigneBrisee; import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; import org.fudaa.ebli.commun.EbliLib; - import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.MvResource; import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; +import com.memoire.bu.BuBorders; +import com.memoire.bu.BuGlassPaneStop; +import com.memoire.bu.BuHorizontalLayout; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuRadioButton; +import com.memoire.bu.BuScrollPane; +import com.memoire.bu.BuVerticalLayout; +import com.vividsolutions.jts.geom.LineString; + public class MvProfileBuilderFromTree extends MvProfileBuilder { - final LineString initSelected_; + public final LineString initSelected_; final CalqueFindCourbeTreeModel lineTreeModel_; + ZEbliCalquesPanel calque_; + + /** + * panel qui contient les calques des isolignes + */ + BuPanel panelTreeIsoLignes; + + /** + * panel des pas de temps et variables + */ + MvExportChooseVarAndTime varTime_; + + + public MvExportChooseVarAndTime getVarTime() { + return varTime_; + } + public BuPanel getPanelTreeIsoLignes() { + return panelTreeIsoLignes; + } + public MvProfileBuilderFromTree(final MvProfileTarget _data, final CtuluUI _ui, final LineString _selected, final ZEbliCalquesPanel _panel, EfLineIntersectionsCorrectionTester _tester) { super(_data, _ui, _panel, _tester); lineTreeModel_ = new CalqueFindCourbeTreeModel(null, _panel.getDonneesCalque()); initSelected_ = _selected; + calque_ = _panel; } - LineString getSelectedLineInTree(final JTree _tree) { + public LineString getSelectedLineInTree(final JTree _tree) { if (_tree.isSelectionEmpty()) { return null; } @@ -72,7 +89,7 @@ return (LineString) cq.getModele().getGeomData().getGeometry(node.getIdxPoly()); } - String getSelectedLineTitle(final JTree _tree) { + public String getSelectedLineTitle(final JTree _tree) { if (_tree.isSelectionEmpty()) { return null; } @@ -96,30 +113,36 @@ } - protected void stepOne() { - final BuPanel selectLine = new BuPanel(new BuVerticalLayout(3)); - final JTree tree = buildTree(); - selectLine.add(new BuLabel(MvResource.getS("S\xE9lectionner la ligne \xE0 utiliser pour le profil"))); - final BuRadioButton btSelectedLine = new BuRadioButton(MvResource.getS("Utiliser La ligne s\xE9lectionn\xE9e")); - final BuRadioButton btSelectInTree = new BuRadioButton(MvResource.getS("Utiliser une ligne disponible:")); + public BuRadioButton btSelectedLine_; + public BuRadioButton btSelectInTree_; + public JTree tree_; + /** + * construit les panels des parametres. + */ + public void stepOne() { + panelTreeIsoLignes = new BuPanel(new BuVerticalLayout(3)); + tree_ = buildTree(); + panelTreeIsoLignes.add(new BuLabel(MvResource.getS("S\xE9lectionner la ligne \xE0 utiliser pour le profil"))); + btSelectedLine_ = new BuRadioButton(MvResource.getS("Utiliser La ligne s\xE9lectionn\xE9e")); + btSelectInTree_ = new BuRadioButton(MvResource.getS("Utiliser une ligne disponible:")); final ButtonGroup bg = new ButtonGroup(); - bg.add(btSelectedLine); - bg.add(btSelectInTree); - final BuScrollPane buScrollPane = new BuScrollPane(tree); + bg.add(btSelectedLine_); + bg.add(btSelectInTree_); + final BuScrollPane buScrollPane = new BuScrollPane(tree_); buScrollPane.setPreferredHeight(200); - selectLine.add(btSelectedLine); - selectLine.add(btSelectInTree); + panelTreeIsoLignes.add(btSelectedLine_); + panelTreeIsoLignes.add(btSelectInTree_); buScrollPane.setBorder(BuBorders.EMPTY2500); - selectLine.add(buScrollPane); + panelTreeIsoLignes.add(buScrollPane); if (initSelected_ == null) { - btSelectedLine.setEnabled(false); - btSelectInTree.setSelected(true); + btSelectedLine_.setEnabled(false); + btSelectInTree_.setSelected(true); } else { - btSelectedLine.setSelected(true); - tree.setEnabled(false); + btSelectedLine_.setSelected(true); + tree_.setEnabled(false); this.update(initSelected_, false); } - final MvExportChooseVarAndTime varTime = createVarTimeChooser(getHelpForVarTime()); + varTime_ = createVarTimeChooser(getHelpForVarTime()); final CtuluDialogPanel pn = new CtuluDialogPanel() { public boolean valide() { @@ -127,12 +150,12 @@ return false; } - if (btSelectedLine.isSelected()) { + if (btSelectedLine_.isSelected()) { MvProfileBuilderFromTree.this.selectedLine_ = initSelected_; MvProfileBuilderFromTree.this.name_ = EbliLib.getS("S\xE9lection"); } else { - MvProfileBuilderFromTree.this.selectedLine_ = getSelectedLineInTree(tree); - MvProfileBuilderFromTree.this.name_ = getSelectedLineTitle(tree); + MvProfileBuilderFromTree.this.selectedLine_ = getSelectedLineInTree(tree_); + MvProfileBuilderFromTree.this.name_ = getSelectedLineTitle(tree_); } final JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, this); final CtuluTaskDelegate task = MvProfileBuilderFromTree.this.ui_.createTask(FudaaLib @@ -141,7 +164,7 @@ d.setGlassPane(glassPaneStop); task.start(new Runnable() { public void run() { - intersectTest(d, varTime, task.getStateReceiver()); + intersectTest(d, varTime_, task.getStateReceiver()); glassPaneStop.setVisible(false); d.getRootPane().remove(glassPaneStop); } @@ -153,46 +176,59 @@ final ListSelectionListener listListener = new ListSelectionListener() { public void valueChanged(ListSelectionEvent _e) { - updateError(pn, tree, varTime); + updateError(pn, tree_, varTime_); } }; - if (varTime.getTimeSelectionModel() != null) { - varTime.getTimeSelectionModel().addListSelectionListener(listListener); + if (varTime_.getTimeSelectionModel() != null) { + varTime_.getTimeSelectionModel().addListSelectionListener(listListener); } - varTime.getVarSelectionModel().addListSelectionListener(listListener); + varTime_.getVarSelectionModel().addListSelectionListener(listListener); - tree.addTreeSelectionListener(new TreeSelectionListener() { + tree_.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(final TreeSelectionEvent _e) { - updateError(pn, tree, varTime); - MvProfileBuilderFromTree.this.update(getSelectedLineInTree(tree), true); + updateError(pn, tree_, varTime_); + MvProfileBuilderFromTree.this.update(getSelectedLineInTree(tree_), true); } }); // le selectionneur pour le bouton - btSelectedLine.addItemListener(new ItemListener() { + btSelectedLine_.addItemListener(new ItemListener() { public void itemStateChanged(final ItemEvent _e) { - tree.setEnabled(!btSelectedLine.isSelected()); - if (btSelectedLine.isSelected()) { + tree_.setEnabled(!btSelectedLine_.isSelected()); + if (btSelectedLine_.isSelected()) { MvProfileBuilderFromTree.this.update(initSelected_, MvProfileBuilderFromTree.this.isZoomChanged_); - } else if (tree.isSelectionEmpty()) { + } else if (tree_.isSelectionEmpty()) { MvProfileBuilderFromTree.this.update(null, false); } else { - MvProfileBuilderFromTree.this.update(getSelectedLineInTree(tree), true); + MvProfileBuilderFromTree.this.update(getSelectedLineInTree(tree_), true); } - updateError(pn, tree, varTime); + updateError(pn, tree_, varTime_); } }); pn.setLayout(new BuHorizontalLayout(5)); - selectLine.setBorder(CtuluLibSwing.createTitleBorder(CtuluLib.getS("Etape {0}:", CtuluLibString.UN))); - varTime.setBorder(CtuluLibSwing.createTitleBorder(CtuluLib.getS("Etape {0}:", CtuluLibString.DEUX))); - pn.add(selectLine); - pn.add(varTime); + panelTreeIsoLignes.setBorder(CtuluLibSwing.createTitleBorder(CtuluLib.getS("Etape {0}:", CtuluLibString.UN))); + varTime_.setBorder(CtuluLibSwing.createTitleBorder(CtuluLib.getS("Etape {0}:", CtuluLibString.DEUX))); + pn.add(panelTreeIsoLignes); + pn.add(varTime_); pn.setBorder(BuBorders.EMPTY3333); - updateError(pn, tree, varTime); - pn.afficheModale(ui_.getParentComponent(), MvResource.getS("Profils spatiaux"), varTime.getListRunnable()); + updateError(pn, tree_, varTime_); + + + + // -- integration du parent component dans le wizard des profils spatiaux + // --// + + + // pn.afficheModale(ui_.getParentComponent(), + // MvResource.getS("Profils spatiaux"), varTime.getListRunnable()); close(); + + + + + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -14,12 +14,9 @@ import javax.swing.JComponent; -import com.memoire.bu.BuMenu; - import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluUndoRedoInterface; - import org.fudaa.ebli.calque.BArbreCalque; import org.fudaa.ebli.calque.BGroupeCalque; import org.fudaa.ebli.calque.ZCalqueGrille; @@ -30,10 +27,11 @@ import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliFormatter; import org.fudaa.ebli.commun.EbliSelectionMode; - import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.sig.FSigAttibuteTypeManager; +import com.memoire.bu.BuMenu; + /** * @author deniger * @version $Id: FSigVisuPanel.java,v 1.2 2007-06-11 12:53:36 deniger Exp $ @@ -57,6 +55,7 @@ */ public FSigVisuPanel(final FudaaCommonImplementation _impl) { this(null, _impl); + } public FSigVisuPanel(final BGroupeCalque _gcMain, final FudaaCommonImplementation _impl) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrIsoLayerDefault.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -29,27 +29,18 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import com.vividsolutions.jts.geom.LineString; -import com.vividsolutions.jts.geom.LinearRing; - -import com.memoire.bu.BuMenuItem; -import com.memoire.bu.BuResource; -import com.memoire.fu.FuLog; - import org.fudaa.ctulu.CtuluAnalyze; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.CtuluRange; - import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestElt; import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestNode; import org.fudaa.dodico.ef.operation.EfIsoRestructuredGridActivity; import org.fudaa.dodico.ef.operation.EfIsoRestructuredGridResult; import org.fudaa.dodico.h2d.type.H2dVariableType; - import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.BCalquePersistenceInterface; import org.fudaa.ebli.calque.ZCalqueAffichageDonnees; @@ -78,10 +69,15 @@ import org.fudaa.ebli.trace.TraceIsoSurfacesAvecPlages; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; - import org.fudaa.fudaa.meshviewer.layer.MvNodeLayer; import org.fudaa.fudaa.tr.persistence.TrPostIsoLayerPersistence; +import com.memoire.bu.BuMenuItem; +import com.memoire.bu.BuResource; +import com.memoire.fu.FuLog; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.LinearRing; + /** * Un calque de trace de cartes avec un nouvel algorithme de trace. * @@ -235,6 +231,14 @@ } + + /** + * Methode qui permet de savoir si le point appartient a la sonde + * + * @param _prReel + * @param _model + * @return + */ public static int sondeSelection(final GrPoint _prReel, final TrPostModelInterface _model) { EfGridInterface grid = _model.getGrid(); if (grid.getIndex() != null) { @@ -328,7 +332,7 @@ return s; } - protected final TrIsoModelAbstract getIsoModelAbstract() { + public final TrIsoModelAbstract getIsoModelAbstract() { return (TrIsoModelAbstract) modele_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionAddPointFromWidgetCalque.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -30,7 +30,6 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluResource; -import org.fudaa.ctulu.CtuluTaskDelegate; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.courbe.EGGraphe; @@ -41,7 +40,6 @@ import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; -import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.profile.MvProfileBuilderFromTree; import org.fudaa.fudaa.meshviewer.profile.MvProfileCoteTester; import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; @@ -122,7 +120,7 @@ @Override public boolean isCorrectGraph(EGGrapheModel _model) { - // -- ATTENTION ICI ON AJOUTE JUSTE POUR LES COUURBE TEMPORELLE --// + // -- ATTENTION ICI ON AJOUTE JUSTE POUR LES COURBE TEMPORELLE --// return (_model instanceof MvProfileTreeModel); } @@ -130,13 +128,10 @@ @Override public void executeAction(TrPostCommonImplementation _impl, EGGraphe _graphe, TrPostVisuPanel _calque) { - // -- utilisation de l action qui permet d ajouter un profil spatial selectionn\xE9 dans le calque au - // graphe - final CtuluTaskDelegate task = impl_.createTask(FudaaLib.getS("Construction des courbes")); - new MvProfileBuilderFromTree(_calque.getProjet(), impl_, ((ZCalqueAffichageDonneesInterface) _calque - .getArbreCalqueModel().getSelectedCalque()).getSelectedLine(), _calque, new MvProfileCoteTester()) - .actAddGroupForExistingModel(task.getStateReceiver(), (MvProfileTreeModel) _graphe.getModel(), - _calque.srcCont_.src_); + /** + * @see TrPostWizardProfilSpatiaux.java pour savoir comment fusionenr une + * courbe spatiale dans un graphe existant. methode doTask() + */ } @@ -251,11 +246,14 @@ } else if (e.getSource() == creationNewGraphe) { // -- creation d un nouveau graphe --// + if (boxCalques_ != null) { TrPostVisuPanel calqueChoisi = (TrPostVisuPanel) listeCalquesPossibles.get(boxCalques_.getSelectedIndex()); // -- methode appelee qui doit creer un graphe avec la selection --// createNewGraphe(calqueChoisi); - + } else { + createNewGraphe(listeCalquesPossibles.get(0)); + } // -- on doit remettre a jour les infos --// // frame_.dispose(); // rechercheGrapheAndCalque(); @@ -293,7 +291,7 @@ listeCalquesPossibles.add((TrPostVisuPanel) new_name.getCalque()); JLabel label = new JLabel(); - BufferedImage image = new_name.getCalque().produceImage(50, 50, params); + BufferedImage image = new_name.getCalque().produceImage(80, 50, params); Icon icone = new ImageIcon(image); label.setIcon(icone); label.setText(currentNode.getTitle()); @@ -306,7 +304,7 @@ if (isCorrectGraph(new_name.getGraphe().getModel())) { JLabel label = new JLabel(); - BufferedImage image = new_name.getGraphe().produceImage(50, 50, params); + BufferedImage image = new_name.getGraphe().produceImage(80, 50, params); Icon icone = new ImageIcon(image); label.setIcon(icone); @@ -359,13 +357,21 @@ * * @return */ - public JComponent constructInterface(boolean closeDialog, boolean valideAjoutCourbe, boolean canCreate) { + public JComponent constructInterface(boolean chooserCalque, boolean closeDialog, boolean valideAjoutCourbe, + boolean canCreate) { + + JPanel content = new JPanel(new BorderLayout()); + + if (chooserCalque) { boxCalques_ = new JComboBox(); for (Iterator<JLabel> it = listeObjetsCalques.iterator(); it.hasNext();) { boxCalques_.addItem(it.next()); } boxCalques_.setRenderer(new GrapheCellRenderer()); boxCalques_.setBorder(BorderFactory.createTitledBorder(TrResource.TR.getString("Liste des calques de la scene"))); + content.add(boxCalques_, BorderLayout.NORTH); + + } jlisteGraphesChoix = new JList(modelGraphesPossibles); jlisteGraphesChoix.setCellRenderer(new GrapheCellRenderer()); @@ -414,10 +420,10 @@ box.add(boxButton); box.add(jlisteGraphesSelections); - JPanel content = new JPanel(new BorderLayout()); + content.add(box, BorderLayout.CENTER); - content.add(boxCalques_, BorderLayout.NORTH); + @@ -436,7 +442,7 @@ frame_ = new JDialog(); - frame_.setContentPane(constructInterface(true, true, true)); + frame_.setContentPane(constructInterface(true, true, true, true)); frame_.setModal(true); setTitleForFrame(); @@ -456,9 +462,16 @@ */ public JComponent getInterfaceComplete(boolean closeDialog, boolean valideAjoutCourbe, boolean canCreate) { rechercheGrapheAndCalque(); - return constructInterface(closeDialog, valideAjoutCourbe, canCreate); + return constructInterface(true, closeDialog, valideAjoutCourbe, canCreate); } + public JComponent getInterfacePartielle(boolean closeDialog, boolean valideAjoutCourbe, boolean canCreate) { + rechercheGrapheAndCalque(); + + return constructInterface(false, closeDialog, valideAjoutCourbe, canCreate); + } + + public abstract void setTitleForFrame(); } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostActionFusionGraphes.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -0,0 +1,293 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; +import javax.swing.UIManager; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.ProgressionBuAdapter; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.ctulu.image.CtuluLibImage; +import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliNode; +import org.fudaa.ebli.visuallibrary.EbliWidgetBordure; +import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionSimple; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuDialog; +import com.memoire.bu.BuDialogConfirmation; +import com.memoire.fu.FuLog; + +/** + * Classe Fusion Widgets des graphes entre eux pour qu'ils se transforment en + * super sayan Niveau 16... + * + * @author Adrien Hadoux + * + */ +public class TrPostActionFusionGraphes extends EbliWidgetActionSimple { + + TrPostProjet projet_; + EbliWidgetGraphe widgetGraphe_; + EbliNode nodeGraphe_; + JComboBox boxListeGraphes_; + ArrayList<JLabel> listeObjetsCalques; + ArrayList<EbliNode> listeGraphesPossibles; + JComponent content_; + BuDialog dialog_; + + + public TrPostActionFusionGraphes(EbliWidgetGraphe widget, EbliNode nodeGraphe, + TrPostProjet projet) { + super(widget.getEbliScene(), TrResource.getS("Fusion avec un autre graphe"), CtuluResource.CTULU.getIcon("cible"), + "ADDPOINTWIDGET"); + + + widgetGraphe_ = widget; + nodeGraphe_ = nodeGraphe; + projet_ = projet; + + // -- ajout de la combo dans la toolbar de la widget --// + widgetGraphe_.getController_().getPopup().add(this); + } + + /** + * remplissage de la combo avec les graphes disponibles et compatibles + * + * @param scene + */ + private void remplirCombo() { + Map params = new HashMap(); + CtuluLibImage.setCompatibleImageAsked(params); + listeGraphesPossibles = new ArrayList<EbliNode>(); + listeObjetsCalques = new ArrayList<JLabel>(); + + + // -- remplissage de la liste a partir de l ecoute de la scene--// + Set<EbliNode> listeNode = (Set<EbliNode>) scene_.getObjects(); + for (Iterator<EbliNode> it = listeNode.iterator(); it.hasNext();) { + EbliNode currentNode = it.next(); + + if (currentNode != nodeGraphe_ && currentNode.getCreator() instanceof EbliWidgetCreatorGraphe) { + EbliWidgetCreatorGraphe new_name = (EbliWidgetCreatorGraphe) currentNode.getCreator(); + + FuLog.warning("MODEL GRAPHE je suis instance de " + new_name.getGraphe().getModel()); + if (isCompatibleWithGraphe(new_name.getGraphe())) { + + JLabel label = new JLabel(); + BufferedImage image = new_name.getGraphe().produceImage(70, 30, params); + Icon icone = new ImageIcon(image); + + label.setIcon(icone); + label.setText("Fusionner avec " + currentNode.getTitle()); + listeObjetsCalques.add(label); + listeGraphesPossibles.add(currentNode); + } + } + + + } + + + // -- creation graphique --// + if (boxListeGraphes_ == null) + boxListeGraphes_ = new JComboBox(); + + boxListeGraphes_.removeAllItems(); + + + for (Iterator<JLabel> it = listeObjetsCalques.iterator(); it.hasNext();) { + boxListeGraphes_.addItem(it.next()); + } + boxListeGraphes_.setRenderer(new GrapheCellRenderer()); + + + + + + } + + + /** + * verifie si les graphes sont compatibles + * + * @param graphe + * @return + */ + public boolean isCompatibleWithGraphe(EGGraphe graphe) { + return (this.widgetGraphe_.getGraphe().getModel() instanceof TrPostCourbeTreeModel && graphe.getModel() instanceof TrPostCourbeTreeModel) + || (this.widgetGraphe_.getGraphe().getModel() instanceof MvProfileTreeModel && graphe.getModel() instanceof MvProfileTreeModel); + } + + + public class GrapheCellRenderer extends JLabel implements ListCellRenderer { + private final Color HIGHLIGHT_COLOR = UIManager.getColor("Tree.selectionBackground"); + + public GrapheCellRenderer() { + setOpaque(true); + setIconTextGap(12); + } + + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, + boolean cellHasFocus) { + JLabel entry = (JLabel) value; + setText(entry.getText()); + setIcon(entry.getIcon()); + if (isSelected) { + setBackground(HIGHLIGHT_COLOR); + setForeground(Color.white); + } else { + setBackground(Color.white); + setForeground(Color.black); + } + return this; + } + } + + + JComponent constructPanel() { + JPanel content=new JPanel(new BorderLayout()); + + content.add(new JLabel(TrResource.getS("Fusion avec un autre graphe")), BorderLayout.NORTH); + content.add(boxListeGraphes_, BorderLayout.CENTER); + JButton valide = new JButton(EbliResource.EBLI.getIcon("crystal_valider")); + valide.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent _e) { + + mergeGraph(); + dialog_.dispose(); + } + + }); + + JPanel operations = new JPanel(new FlowLayout(FlowLayout.CENTER)); + operations.add(new JLabel(TrResource.getS("Valider"))); + operations.add(valide); + content.add(operations, BorderLayout.SOUTH); + + return content; + } + + + /** + * Methode qui: merge le graphe choisi dans la combo avec el ndoe actuel + * degage le node choisi de la scene remet a jour al combo actuelle + */ + private void mergeGraph() { + + int selected = boxListeGraphes_.getSelectedIndex(); + if (selected == -1) { + return; + } + EbliNode nodeToMerge = listeGraphesPossibles.get(selected); + + // --recuperation de son graphe --// + EbliWidgetGraphe grapheWidget = null; + if (nodeToMerge.getWidget() instanceof EbliWidgetBordure) + grapheWidget = (EbliWidgetGraphe) ((EbliWidgetBordure) nodeToMerge.getWidget()).getIntern(); + else + grapheWidget = (EbliWidgetGraphe) nodeToMerge.getWidget(); + + //-- cas des graphes temporels + if(widgetGraphe_.getGraphe().getModel() instanceof TrPostCourbeTreeModel){ + final TrPostCourbeTreeModel grapheToMerge = (TrPostCourbeTreeModel) grapheWidget.getGraphe().getModel(); + final TrPostCourbeTreeModel grapheModel = (TrPostCourbeTreeModel) widgetGraphe_.getGraphe().getModel(); + // --ajout de la courbe au widget de base --// + new CtuluTaskOperationGUI(projet_.impl_, TrResource.getS("Fusion avec un autre graphe")) { + + public void act() { + final ProgressionInterface prog = new ProgressionBuAdapter(this); + + //-- cas points reels --// + if (grapheToMerge.getObjIdx() != null && grapheToMerge.getObjIdx().length != 0) + grapheModel.addPoints(grapheToMerge.getObjIdx(), scene_.getCmdMng(), prog, grapheToMerge.getVarSupported()); + //-- cas interpol\xE9 --// + else if(grapheToMerge.getIntepolPt()!=null) + for (Iterator it = grapheToMerge.getIntepolPt().iterator(); it.hasNext();) + grapheModel.addPoints((TrPostInterpolatePoint) it.next(), scene_.getCmdMng(), prog, grapheToMerge + .getVarSupported()); + + } + }.start(); + ; + } + else{ + //-- cas des grapehs spatiaux --// + final MvProfileTreeModel grapheToMerge = (MvProfileTreeModel) grapheWidget.getGraphe().getModel(); + final MvProfileTreeModel grapheModel = (MvProfileTreeModel) widgetGraphe_.getGraphe().getModel(); + // --ajout de la courbe au widget de base --// + final EGGraphe grapheObject = grapheWidget.getGraphe(); + new CtuluTaskOperationGUI(projet_.impl_, TrResource.getS("Fusion avec un autre graphe")) { + + public void act() { + final ProgressionInterface prog = new ProgressionBuAdapter(this); + + grapheModel.addNewCourbe(scene_.getCmdMng(), widgetGraphe_.getPanelGraphe(), grapheObject, + projet_.impl_); + + } + }.start(); + + } + + + // --suppression du graphe merge --// + scene_.removeNodeWithEdges(nodeToMerge); + scene_.refresh(); + + // -- maj de la combo --// + remplirCombo(); + + } + + + public void actionPerformed(ActionEvent _e) { + + // -- remplisage combo --// + remplirCombo(); + + dialog_ = new BuDialogConfirmation(projet_.impl_, projet_.impl_.getInformationsSoftware(), TrResource + .getS("Fusion avec un autre graphe")); + if (content_ == null) + content_ = constructPanel(); + + + + dialog_.setContentPane(content_); + dialog_.setSize(400, 150); + + dialog_.setModal(true); + dialog_.setVisible(true); + dialog_.setLocationRelativeTo(projet_.getSelectedFilleLayout()); + + + } + + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeAddPointsAction.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -55,7 +55,7 @@ public void act() { final TrPostCourbeTreeModel model = (TrPostCourbeTreeModel) _model.getModel(); - model.addPoints(_pt, _model.getCmd(), new ProgressionBuAdapter(this)); + model.addPoints(_pt, _model.getCmd(), new ProgressionBuAdapter(this), null); BuLib.invokeLater(new Runnable() { public void run() { @@ -72,7 +72,7 @@ public void act() { final TrPostCourbeTreeModel model = (TrPostCourbeTreeModel) _model.getModel(); - model.addPoints(_idx, _model.getCmd(), new ProgressionBuAdapter(this)); + model.addPoints(_idx, _model.getCmd(), new ProgressionBuAdapter(this), null); BuLib.invokeLater(new Runnable() { public void run() { 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 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeBuilder.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -74,15 +74,14 @@ } - private static int cptGraphe = 1; /** * Methode principale de construction d'une courbe avec l'aide d'un wizard */ public static void chooseAndBuild(final TrPostProjet _src, final int[] _ptIdx, final TrPostInterpolatePoint _pt, final H2dVariableType _varSelected, final TrPostVisuPanel _calque) { - if (_ptIdx == null && _pt == null) { - return; - } + // if (_ptIdx == null && _pt == null) { + // return; + // } // final MvExportChooseVarAndTime chooser = new // MvExportChooseVarAndTime(_src.getSource().getNewVarListModel(), _src @@ -115,88 +114,89 @@ // CtuluDialogPanel pn = chooser; //FIXME: a remplacer par une recherche des frames dans le layout actif. // final List fr = TrPostCourbeFille.getCourbeFilleFrames(_src.getImpl()); - // final FudaaInternalFrameSelectorPanel pnFrame = fr.size() == 0 ? null : - // new FudaaInternalFrameSelectorPanel(fr, - // TrLib.getString( - // "Afficher les \xE9volutions temporelles dans une nouvelle fen\xEAtre"), titre); - // if (pnFrame != null) { - // final CtuluDialogPanel completePn = new CtuluDialogPanel() { - // public boolean valide() { - // return pnFrame.getCbNew().isSelected() || - // CtuluLibString.isEmpty(getErrorText()); - // } - // }; - // // pn = completePn; - // // pn.setLayout(new BuBorderLayout(4, 4, true, true)); - // // pn.setBorder(BuBorders.EMPTY3333); - // pn.add(pnFrame, BuBorderLayout.NORTH); - // chooser.setErrorTextUnable(); - // chooser.setBorder(BorderFactory.createEmptyBorder(5, 15, 0, 5)); - // CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); - // pnFrame.getCbNew().addItemListener(new ItemListener() { - // public void itemStateChanged(final ItemEvent _e) { - // CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); - // if (pnFrame.getCbNew().isSelected()) { - // completePn.setErrorText(chooser.computeErrorText()); - // } else { - // completePn.setErrorText(CtuluLibString.EMPTY_STRING); - // } - // } - // }); - // pn.add(chooser, BuBorderLayout.CENTER); - // - // } - // chooser.activeErrorListener(pn); +// final FudaaInternalFrameSelectorPanel pnFrame = fr.size() == 0 ? null : +// new FudaaInternalFrameSelectorPanel(fr, +// TrLib.getString( +// "Afficher les \xE9volutions temporelles dans une nouvelle fen\xEAtre"), titre); +// if (pnFrame != null) { +// final CtuluDialogPanel completePn = new CtuluDialogPanel() { +// public boolean valide() { +// return pnFrame.getCbNew().isSelected() || +// CtuluLibString.isEmpty(getErrorText()); +// } +// }; +// // pn = completePn; +// // pn.setLayout(new BuBorderLayout(4, 4, true, true)); +// // pn.setBorder(BuBorders.EMPTY3333); +// pn.add(pnFrame, BuBorderLayout.NORTH); +// chooser.setErrorTextUnable(); +// chooser.setBorder(BorderFactory.createEmptyBorder(5, 15, 0, 5)); +// CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); +// pnFrame.getCbNew().addItemListener(new ItemListener() { +// public void itemStateChanged(final ItemEvent _e) { +// CtuluLibSwing.setEnable(chooser, null, pnFrame.getCbNew().isSelected()); +// if (pnFrame.getCbNew().isSelected()) { +// completePn.setErrorText(chooser.computeErrorText()); +// } else { +// completePn.setErrorText(CtuluLibString.EMPTY_STRING); +// } +// } +// }); +// pn.add(chooser, BuBorderLayout.CENTER); +// +// } +// chooser.activeErrorListener(pn); // BLOC UTILE POUR REFACTORISATION: LA CREATION DE LA COURBE SE FAIT DANS LE // THREAD - // if (pn.afficheModaleOk(_src.getImpl().getFrame(), titre)) { - // - // - // - // final Object[] obj = chooser.getSelectedVar(); - // final H2dVariableType[] var = new H2dVariableType[obj.length]; - // System.arraycopy(obj, 0, var, 0, var.length); - // // final TrPostCourbeFille fille = pnFrame == null ? null : - // // (TrPostCourbeFille) pnFrame.getSelectedFrame(); - // // if (fille == null) { - // new CtuluTaskOperationGUI(_src.getImpl(), titre) { - // - // public void act() { - // final ProgressionInterface prog = new ProgressionBuAdapter(this); - // final TrPostCourbeTreeModel model = _pt == null ? build(_src.getImpl(), - // _src.getSource(), chooser - // .getSelectedTimeStepIdx(), var, _ptIdx, prog) : build(_src.getImpl(), - // _src.getSource(), chooser - // .getSelectedTimeStepIdx(), var, _pt, prog); - // if (model != null) { - // _src.addFille(model, "graphe " + (cptGraphe++)/* - // * pnFrame == null ? - // * titre :pnFrame. - // * getNewFrameTitle() - // */, prog, _calque); - // } - // } - // }.start(); - // } else { - // if (_ptIdx == null) { - // TrPostCourbeAddPointsAction.startImportInterpolate(_src.getImpl(), - // fille.getGraphe(), _pt); - // } else { - // TrPostCourbeAddPointsAction.startImportIdx(_src.getImpl(), - // fille.getGraphe(), _ptIdx); - // } - // _src.getImpl().activateInternalFrame(fille); - // } - - // } +// if (pn.afficheModaleOk(_src.getImpl().getFrame(), titre)) { +// +// +// +// final Object[] obj = chooser.getSelectedVar(); +// final H2dVariableType[] var = new H2dVariableType[obj.length]; +// System.arraycopy(obj, 0, var, 0, var.length); +// final TrPostCourbeFille fille = pnFrame == null ? null : +// (TrPostCourbeFille) pnFrame.getSelectedFrame(); +// if (fille == null) { +// new CtuluTaskOperationGUI(_src.getImpl(), titre) { +// +// public void act() { +// final ProgressionInterface prog = new ProgressionBuAdapter(this); +// final TrPostCourbeTreeModel model = _pt == null ? build(_src.getImpl(), +// _src.getSource(), chooser +// .getSelectedTimeStepIdx(), var, _ptIdx, prog) : build(_src.getImpl(), +// _src.getSource(), chooser +// .getSelectedTimeStepIdx(), var, _pt, prog); +// if (model != null) { +// _src.addFille(model, "graphe " + (cptGraphe++)/* +// * pnFrame == null ? +// * titre :pnFrame. +// * getNewFrameTitle() +// */, prog, _calque); +// } +// } +// }.start(); +// } else { +// if (_ptIdx == null) { +// TrPostCourbeAddPointsAction.startImportInterpolate(_src.getImpl(), +// fille.getGraphe(), _pt); +// } else { +// TrPostCourbeAddPointsAction.startImportIdx(_src.getImpl(), +// fille.getGraphe(), _ptIdx); +// } +// _src.getImpl().activateInternalFrame(fille); +// } +// +// } // -- wizard construction --// - TrPostWizardCourbeTemporelle wizard = new TrPostWizardCourbeTemporelle(chooser, - new TrPostActionAddPointFromWidgetCalque.Temporel(_src.getSelectedFilleLayout().getScene(), _src.getImpl())); + TrPostWizardCourbeTemporelle wizard = new TrPostWizardCourbeTemporelle(_calque,_src,chooser, + new TrPostActionAddPointFromWidgetCalque.Temporel(_src.getSelectedFilleLayout().getScene(), _src.getImpl()), + _ptIdx, _pt); BuWizardDialog DialogWizard = new BuWizardDialog(_src.getImpl().getFrame(), wizard); @@ -207,6 +207,8 @@ } + + public static void chooseAndBuild(final TrPostProjet _src, final TrPostInterpolatePoint _pt, final H2dVariableType _varSelected, TrPostVisuPanel _calque) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2008-09-10 18:55:59 UTC (rev 3906) @@ -113,6 +113,7 @@ public static EGCourbeChild buildCourbeModel(final H2dVariableType _var, final int _idxPt, final double[] _ts, final EGGroup _group, final TrPostSource _src) { final TrPostCourbeModel model = new TrPostCourbeModel.Node(_src, _idxPt, _var, _ts); + final EGCourbeChild courbe = new FudaaCourbeTime(_group, model, _src.getNewTimeListModel()); _group.addEGComponent(courbe); courbe.getModel().setTitle(courbe.getModel().getTitle() + CtuluLibString.ESPACE + (_idxPt + 1)); 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 2008-09-10 18:54:20 UTC (rev 3905) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2008-09-... [truncated message content] |
[Fudaa-svn-commit] SF.net SVN: fudaa:[3915]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <had...@us...> - 2008-09-13 20:17:15
|
Revision: 3915 http://fudaa.svn.sourceforge.net/fudaa/?rev=3915&view=rev Author: hadouxad Date: 2008-09-13 20:17:25 +0000 (Sat, 13 Sep 2008) Log Message: ----------- COrrection bugs - action configurer: delegue toujours a son widgetBordure. - cas special legende: Copier/couper: lors de la copie/couper de legende, n enregistre rien pour eviter le plantage. Correction bug wizard courbes temporelles - l'action ajouter en cliquant sur la ligene de la cellule vide - action supprimer: qui supprime les points saisis - action modifs: en double cliquant sur les cellules (cf setValueAt) - s'il n'y a pas de graphe dispo, l'option cr?\195?\169e un nouveau graphe doit etre coch?\195?\169e et disable ( l'utilisateur n'a pas le choix...) - Bug bizarre lors de la saisie de certains points pour les courbes temporelles... FONCTION AJOUT COURBE SOURCE OK!! - Fonction clic droit sur courbe du graphe FONCTIONNE! - methode TrPostCourbeTreeModel.duplicateWithChooseSrc() - Il fallait initialiser le tableau des y en recuperant la taille du y de son duplicata - utilsier la methode update - GESTION DE TOUS LEs CAS (tentative) - creation courbe REELLE sur nouveau src depuis courbe REELLE ancien source - creation courbe INTERPOLEE sur nouveau src depuis courbe REELLE ancien source - creation courbe REELLE sur nouveau src depuis courbe INTERPOLEE ancien source - creation courbe INTERPOLEE sur nouveau src depuis courbe INTERPOLEE ancien source Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/model/MvElementModelDefault.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2008-09-13 20:14:57 UTC (rev 3914) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2008-09-13 20:17:25 UTC (rev 3915) @@ -22,6 +22,10 @@ private double[] time_; + public double[] getTime() { + return time_; + } + CtuluRange yRange_; protected String nom_; @@ -56,7 +60,7 @@ } } - protected double[] getY() { + public double[] getY() { return y_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/model/MvElementModelDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/model/MvElementModelDefault.java 2008-09-13 20:14:57 UTC (rev 3914) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/model/MvElementModelDefault.java 2008-09-13 20:17:25 UTC (rev 3915) @@ -11,15 +11,11 @@ import javax.swing.table.AbstractTableModel; -import com.memoire.bu.BuTable; - import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.gui.CtuluTable; - import org.fudaa.dodico.ef.EfElement; import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.ef.impl.EfGrid; - import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZModeleDonnesAbstract; import org.fudaa.ebli.commun.EbliTableInfoPanel; @@ -28,10 +24,11 @@ import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.geometrie.GrPolygone; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; - import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.MvResource; +import com.memoire.bu.BuTable; + /** * @author Fred Deniger * @version $Id: MvElementModelDefault.java,v 1.1 2007-01-19 13:14:18 deniger Exp $ @@ -88,6 +85,10 @@ protected EfGridInterface g_; + public EfGridInterface getG() { + return g_; + } + public MvElementModelDefault(final EfGridInterface _g) { this(_g, null); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4020]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <had...@us...> - 2008-10-01 17:49:40
|
Revision: 4020 http://fudaa.svn.sourceforge.net/fudaa/?rev=4020&view=rev Author: hadouxad Date: 2008-10-01 17:49:28 +0000 (Wed, 01 Oct 2008) Log Message: ----------- commit partiel Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaGrapheWizardImportScope.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2008-10-01 16:56:01 UTC (rev 4019) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2008-10-01 17:49:28 UTC (rev 4020) @@ -331,7 +331,14 @@ return content; } + + /** + * Creation du panel scopGene pour choisir ses parametres + * @return + */ JPanel buildPanelScopeGENE(){ + + return null; } Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaGrapheWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaGrapheWizardImportScope.java 2008-10-01 16:56:01 UTC (rev 4019) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaGrapheWizardImportScope.java 2008-10-01 17:49:28 UTC (rev 4020) @@ -1,434 +0,0 @@ -package org.fudaa.fudaa.commun.courbe; - -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; - -import javax.swing.AbstractAction; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.filechooser.FileFilter; - -import org.fudaa.ctulu.CtuluCommandManager; -import org.fudaa.ctulu.CtuluIOOperationSynthese; -import org.fudaa.ctulu.CtuluLib; -import org.fudaa.ctulu.CtuluLibArray; -import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.ctulu.fileformat.FileFormat; -import org.fudaa.ctulu.fileformat.FileFormatUnique; -import org.fudaa.ctulu.gui.CtuluFileChooser; -import org.fudaa.ctulu.gui.CtuluLibSwing; -import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; -import org.fudaa.dodico.mesure.EvolutionFileFormat; -import org.fudaa.dodico.reflux.io.CLTransitoireFileFormat; -import org.fudaa.dodico.reflux.io.CrbFileFormat; -import org.fudaa.dodico.rubar.io.RubarCLIFileFormat; -import org.fudaa.dodico.rubar.io.RubarTARFileFormat; -import org.fudaa.dodico.telemac.io.ScopeGENEFileFormat; -import org.fudaa.dodico.telemac.io.ScopeSFileFormat; -import org.fudaa.dodico.telemac.io.ScopeStructure; -import org.fudaa.dodico.telemac.io.ScopeTFileFormat; -import org.fudaa.dodico.telemac.io.TelemacLiquideFileFormat; -import org.fudaa.ebli.commun.EbliActionSimple; -import org.fudaa.ebli.courbe.EGGraphe; -import org.fudaa.fudaa.commun.FudaaLib; -import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; -import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporterScope; -import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; -import org.fudaa.fudaa.commun.impl.FudaaGuiLib; -import org.fudaa.fudaa.tr.common.TrResource; - -import com.memoire.bu.BuButton; -import com.memoire.bu.BuButtonPanel; -import com.memoire.bu.BuCharValidator; -import com.memoire.bu.BuFileFilter; -import com.memoire.bu.BuResource; -import com.memoire.bu.BuStringValidator; -import com.memoire.bu.BuTextField; -import com.memoire.bu.BuValueValidator; -import com.memoire.bu.BuWizardDialog; -import com.memoire.bu.BuWizardTask; - -/** - * Wizard qui se charge d'importer des courbes au format scope dans le post. - * - * Pour personnaliser le format final du graphe et son affichage, il faut surcharger la methode - * createGraphImported() - * @author Adrien Hadoux - * - */ -public class FudaaGrapheWizardImportScope extends BuWizardTask { - - //donnees haut niveau - FudaaCommonImplementation impl_; - - /** - * type de fomat: - * 0 => scops - * 1 =>scopT - * 2=>scopgene - */ - int typeFormat_; - File fileChoosen_=null; - ScopeStructure data_; - EGGraphe result_; - - //choix du fichier - JPanel panelFichier_; - BuTextField filePath_; - - //choix parametres s t ou gene - JPanel panelParametres_; - - //choix donnees S et T - BuTextField plageDeb_=new BuTextField(5); - BuTextField plageFin_=new BuTextField(5); - JList listVariables_; - - - public static class ImportAction extends EbliActionSimple { - final FudaaCommonImplementation ui_; - public ImportAction(final FudaaCommonImplementation _ui) { - super(BuResource.BU.getString("Importer au format scope"), BuResource.BU.getIcon("IMPORTER"), "IMPORTER"); - ui_ = _ui; - } - public void actionPerformed(final ActionEvent _e) { - FudaaGrapheWizardImportScope wizard=new FudaaGrapheWizardImportScope(ui_); - BuWizardDialog DialogWizard = new BuWizardDialog(ui_.getFrame(), wizard); - // --affichage du wizard --// - DialogWizard.setSize(600, 500); - DialogWizard.setLocationRelativeTo(ui_.getFrame()); - DialogWizard.setVisible(true); - } - } - - - public FudaaGrapheWizardImportScope(FudaaCommonImplementation impl) { - super(); - - impl_=impl; - } - - - @Override - public JComponent getStepComponent() { - switch (current_) { - case 0: { - - if(panelFichier_==null) - panelFichier_=buildFilePanel(); - return panelFichier_; - } - case 1: { - - if(data_==null){ - return new JLabel(TrResource.getS("Erreur. Veuillez choisir un fichier valide")); - } - - if(panelParametres_==null) - panelParametres_=buildPanelParametresImportation(); - return panelParametres_; - } - - } - - return null; - } - - @Override - public int getStepCount() { - // TODO Auto-generated method stub - return 2; - } - - @Override - public String getStepText() { - // TODO Auto-generated method stub - return null; - } - - ScopeStructure.SorT dataST(){ - return (ScopeStructure.SorT)data_; - } - - ScopeStructure.Gene dataG(){ - return (ScopeStructure.Gene)data_; - } - - @Override - public String getStepTitle() { - String r = null; - - switch (current_) { - case 0: - r = TrResource.getS("Choisir le fichier"); - break; - case 1: - r = TrResource.getS("Param\xE8tres de cr\xE9ation"); - break; - - } - return r; - } - - /** - * construit le panel de selection du fichier - * @return - */ - JPanel buildFilePanel(){ - JPanel content=new JPanel(new FlowLayout(FlowLayout.CENTER)); - content.add(new JLabel(TrResource.getS("Choisir le fichier:"))); - filePath_=new BuTextField(20); - filePath_.setEnabled(false); - content.add(filePath_); - BuButton parcourir =new BuButton(TrResource.getS("Parcourir...")); - parcourir.addActionListener(new ActionListener(){ - public void actionPerformed(ActionEvent arg0) { - final FileFormat[] ft = getFileFormatForImport(); - Arrays.sort(ft); - final BuFileFilter[] filters = FileFormat.createFilters(ft); - final CtuluFileChooser fileChooser = FudaaGuiLib.getFileChooser(BuResource.BU.getString("Importer"), filters, - null); - fileChooser.setAcceptAllFileFilterUsed(false); - for (int i = filters.length - 1; i >= 0; i--) { - if (ft[i].getID() == EvolutionFileFormat.getInstance().getID()) { - fileChooser.setFileFilter(filters[i]); - break; - } - } - final File initFile = FudaaGuiLib.chooseFile(CtuluLibSwing.getFrameAncestor(impl_.getParentComponent()), true,fileChooser); - if (initFile == null) { - return; - } - filePath_.setText(initFile.getAbsolutePath()); - - final FileFilter filter = fileChooser.getFileFilter(); - final int i = CtuluLibArray.getIndex(filter, filters); - if (i < 0) { - return; - } - typeFormat_=i; - fileChoosen_=initFile; - importData(); - - - - } - - }); - content.add(parcourir); - return content; - } - - /** - * Retourne les formats de fichiers disponibles - * @return - */ - public static FileFormat[] getFileFormatForImport() { - final ArrayList<FileFormatUnique> r = new ArrayList<FileFormatUnique>(10); - r.add(ScopeSFileFormat.getInstance()); - r.add(ScopeTFileFormat.getInstance()); - r.add(ScopeGENEFileFormat.getInstance()); - final FileFormat[] rf = new FileFormat[r.size()]; - r.toArray(rf); - return rf; - } - - - /** - * Methode iumportante d'importation des datas en fonction du fichier choisi et du type. - * Remplit la structure scope - */ - private void importData(){ - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { - public void act() { - final ProgressionInterface prog = getMainStateReceiver(); - - switch(typeFormat_){ - case 0: - //cas s - data_=lectureScopeS(fileChoosen_,prog); - break; - case 1: - //cas scopT - data_=lectureScopeT(fileChoosen_,prog); - break; - case 2: - //cas scopGENE - data_=lectureScopeGENE(fileChoosen_,prog); - break; - } - - }}.start(); - - } - - private ScopeStructure.SorT lectureScopeS(final File _f,ProgressionInterface prog) { - final CtuluIOOperationSynthese op = ScopeSFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); - final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); - return struct; - } - private ScopeStructure.SorT lectureScopeT(final File _f,ProgressionInterface prog) { - final CtuluIOOperationSynthese op = ScopeTFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); - final ScopeStructure.SorT struct = (ScopeStructure.SorT) op.getSource(); - return struct; - } - private ScopeStructure.Gene lectureScopeGENE(final File _f,ProgressionInterface prog) { - final CtuluIOOperationSynthese op = ScopeGENEFileFormat.getInstance().getLastVersionInstance(null).read(_f, prog); - final ScopeStructure.Gene struct = (ScopeStructure.Gene) op.getSource(); - return struct; - } - - - /** - * Construit le panel de choix des donn\xE9es a importer pour les formats s et t - * @return - */ - double Xmin,Xmax; - JPanel buildPanelScopeSorT(){ - JPanel content=new JPanel(new BorderLayout()); - - String[] listeVar=new String[dataST().getNbVariables()-1]; - - //on ne prends pas les x - for(int i=1;i<dataST().getNbVariables();i++) - listeVar[i-1]=dataST().getVariable(i); - - listVariables_=new JList(listeVar); - listVariables_.setSelectedIndex(0); - content.add(listVariables_,BorderLayout.CENTER); - listVariables_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); - - plageDeb_.setCharValidator(BuCharValidator.FLOAT); - plageDeb_.setStringValidator(BuStringValidator.FLOAT); - plageDeb_.setValueValidator(BuValueValidator.FLOAT); - plageFin_.setCharValidator(BuCharValidator.FLOAT); - plageFin_.setStringValidator(BuStringValidator.FLOAT); - plageFin_.setValueValidator(BuValueValidator.FLOAT); - - //-- on init les plages --// - Xmin=dataST().getXMin(); - plageDeb_.setText(""+Xmin); - Xmax=dataST().getXMax(); - plageFin_.setText(""+Xmax); - - JPanel plages=new JPanel(new FlowLayout(FlowLayout.CENTER)); - plages.add(new JLabel(TrResource.getS("Choisir la plage des abscisses"))); - plages.add(plageDeb_); - plages.add(new JLabel("-")); - plages.add(plageFin_); - plages.add(new JLabel("(Min: "+Xmin+", Max: "+Xmax+")")); - content.add(plages,BorderLayout.SOUTH); - - return content; - } - - JPanel buildPanelScopeGENE(){ - return null; - } - - JPanel buildPanelParametresImportation(){ - switch(typeFormat_){ - case 0: - //cas s - return buildPanelScopeSorT(); - case 1: - //cas scopT - return buildPanelScopeSorT(); - case 2: - //cas scopGENE - return buildPanelScopeGENE(); - } - - return null; - } - - public String getTaskTitle() { - // TODO Auto-generated method stub - return TrResource.getS("Importation depuis les formats Scop S, T et GENE"); - } - - /** - * MEthode utilisee pour disabler ou non les boutons suivants - */ - public int getStepDisabledButtons() { - int r = super.getStepDisabledButtons(); - if (current_ == 1) { - - //cas scope s ou t - if(typeFormat_==1 || typeFormat_==0){ - if(data_==null) - r |= BuButtonPanel.TERMINER; - else - if(plageDeb_.getText().equals("") || plageFin_.getText().equals("")) - r |= BuButtonPanel.TERMINER; - else{ - //verifier que les plages ne sont pas depassees - double valDeb=Double.parseDouble(plageDeb_.getText()); - double valFin=Double.parseDouble(plageFin_.getText()); - if(valDeb<Xmin || Xmax<valFin) - r |= BuButtonPanel.TERMINER; - } - - }else{ - //cas scope gene - } - - } - return r; - } - - - public void doTask() { - done_ = true; - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Importation graphe")) { - public void act() { - final ProgressionInterface prog = getMainStateReceiver(); - //mise a jour de la structure - impl_.setMainProgression(10); - impl_.setMainMessage(CtuluLib.getS("Structure modification")); - prog.setProgression(10); - prog.setDesc(CtuluLib.getS("Structure modification")); - if(typeFormat_<=1) - dataST().restreindreStructure(listVariables_.getSelectedIndices(),Double.parseDouble(plageDeb_.getText()),Double.parseDouble(plageFin_.getText())); - - - impl_.setMainProgression(30); - impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); - // creation du graphe - switch(typeFormat_){ - case 0: - //cas s - result_=FudaaCourbeImporterScope.createGrapheSpatialGraphe(dataST(),prog);break; - case 1: - //cas scopT - result_=FudaaCourbeImporterScope.createGrapheTemporel(dataST(),prog);break; - case 2: - //cas scopGENE - result_=FudaaCourbeImporterScope.createGrapheTemporelGENE(dataG(),prog);break; - } - - //-- mise en forme du resultata g\xE9n\xE9r\xE9 --// - createGraphImported(result_); - } - }.start(); - } - - - /** - * Methode a surcharger. - * Appel\xE9e a la toute fin, gere le resultat - */ - public void createGraphImported(EGGraphe grapheGenere){ - //placer le graphe ou vous voulez... - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java 2008-10-01 16:56:01 UTC (rev 4019) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostWizardImportScope.java 2008-10-01 17:49:28 UTC (rev 4020) @@ -41,7 +41,7 @@ import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporterScope; -import org.fudaa.fudaa.commun.courbe.FudaaGrapheWizardImportScope; +import org.fudaa.fudaa.commun.courbe.FudaaCourbeWizardImportScope; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.commun.impl.FudaaGuiLib; import org.fudaa.fudaa.tr.common.TrResource; @@ -62,7 +62,7 @@ * @author Adrien Hadoux * */ -public class TrPostWizardImportScope extends FudaaGrapheWizardImportScope { +public class TrPostWizardImportScope extends FudaaCourbeWizardImportScope { TrPostProjet projet_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4124]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <de...@us...> - 2008-10-30 17:11:13
|
Revision: 4124 http://fudaa.svn.sourceforge.net/fudaa/?rev=4124&view=rev Author: deniger Date: 2008-10-30 17:11:11 +0000 (Thu, 30 Oct 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrPostActionLigneCourants.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiFlecheModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiProfileSplitter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiZoneOperation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostProfileAction.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java 2008-10-30 17:10:41 UTC (rev 4123) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvElementLayer.java 2008-10-30 17:11:11 UTC (rev 4124) @@ -19,6 +19,7 @@ import org.fudaa.dodico.ef.EfElementVolume; import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.ef.EfGridVolumeInterface; +import org.fudaa.dodico.ef.operation.EfIndexHelper; import org.fudaa.dodico.ef.operation.EfIndexVisitorHashSet; import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestElt; import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestNode; @@ -261,11 +262,11 @@ if (Fu.DEBUG && FuLog.isDebug()) { FuLog.debug("FMV: layer select from index"); } - final EfGridInterface grid = getGrid(); - final double toleranceReel = GrMorphisme.convertDistanceXY(getVersReel(), _tolerance); - final EfIndexVisitorNearestElt visitor = new EfIndexVisitorNearestElt(grid, _pt.x_, _pt.y_, toleranceReel); - grid.getIndex().query(EfIndexVisitorNearestNode.getEnvelope(_pt.x_, _pt.y_, toleranceReel), visitor); - return visitor.getSelection(); + return EfIndexHelper.getNearestElement(getGrid(), _pt.x_, _pt.y_, GrMorphisme.convertDistanceXY(getVersReel(), + _tolerance), null); +// final EfIndexVisitorNearestElt visitor = new EfIndexVisitorNearestElt(grid, _pt.x_, _pt.y_, toleranceReel); +// grid.getIndex().query(EfIndexVisitorNearestNode.getEnvelope(_pt.x_, _pt.y_, toleranceReel), visitor); +// return visitor.getSelection(); } @Override Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java 2008-10-30 17:10:41 UTC (rev 4123) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvNodeLayer.java 2008-10-30 17:11:11 UTC (rev 4124) @@ -15,6 +15,7 @@ import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.gis.GISLib; import org.fudaa.dodico.ef.EfGridInterface; +import org.fudaa.dodico.ef.operation.EfIndexHelper; import org.fudaa.dodico.ef.operation.EfIndexVisitorHashSetNode; import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestNode; import org.fudaa.ebli.calque.ZCalquePoint; @@ -135,12 +136,14 @@ if (Fu.DEBUG && FuLog.isDebug()) { FuLog.debug("FMV: layer select from index"); } - final double toleranceReel = GrMorphisme.convertDistanceXY(getVersReel(), _tolerance); - final EfIndexVisitorNearestNode visitor = new EfIndexVisitorNearestNode(getNodeModel().getGrid(), _pt.x_, _pt.y_, - toleranceReel); - getNodeModel().getGrid().getIndex().query(EfIndexVisitorNearestNode.getEnvelope(_pt.x_, _pt.y_, toleranceReel), - visitor); - return visitor.getSelection(); + + return EfIndexHelper.getNearestNode(getNodeModel().getGrid(), _pt.x_, _pt.y_, GrMorphisme.convertDistanceXY( + getVersReel(), _tolerance), null); +// final EfIndexVisitorNearestNode visitor = new EfIndexVisitorNearestNode(getNodeModel().getGrid(), _pt.x_, _pt.y_, +// toleranceReel); +// getNodeModel().getGrid().getIndex().query(EfIndexVisitorNearestNode.getEnvelope(_pt.x_, _pt.y_, toleranceReel), +// visitor); +// return visitor.getSelection(); } /** Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java 2008-10-30 17:10:41 UTC (rev 4123) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/layer/MvVisuPanel.java 2008-10-30 17:11:11 UTC (rev 4124) @@ -27,6 +27,7 @@ import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.ef.EfGridVolumeInterface; import org.fudaa.ebli.calque.BGroupeCalque; +import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.edition.ZCalqueEditionGroup; import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; @@ -50,6 +51,7 @@ import com.memoire.bu.BuDynamicMenu; import com.memoire.bu.BuMenu; import com.memoire.bu.BuPopupMenu; +import com.vividsolutions.jts.geom.LineString; /** * @author deniger @@ -168,8 +170,6 @@ private BuMenu edgeDisplayTools_; - - /** * @param _impl l'implementation parente */ @@ -440,6 +440,15 @@ return getName(); } + /** + * @return la ligne selectionnee dans le calque selectionne ou null si aucune + */ + public LineString getSelectedLine() { + // pas de calque s\xE9lectionn\xE9 + if (!(getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { return null; } + return ((ZCalqueAffichageDonneesInterface) getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); + } + public void setActive(final boolean _b) {} /** Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrPostActionLigneCourants.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrPostActionLigneCourants.java 2008-10-30 17:10:41 UTC (rev 4123) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrPostActionLigneCourants.java 2008-10-30 17:11:11 UTC (rev 4124) @@ -4,29 +4,29 @@ import org.fudaa.ctulu.CtuluResource; import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.fudaa.commun.impl.FudaaPanelTask; import org.fudaa.fudaa.meshviewer.MvResource; -import org.fudaa.fudaa.tr.post.TrPostProjet; import org.fudaa.fudaa.tr.post.TrPostVisuPanel; import org.fudaa.fudaa.tr.post.dialogSpec.TrPostDialogLigneCourants; +/** + * Permet d'afficher le dialogue pour les trajectoire/ligne de courant + */ public class TrPostActionLigneCourants extends EbliActionSimple { // final MvProfileTarget src_; - TrPostProjet projet_; TrPostVisuPanel calque_; - public TrPostActionLigneCourants(final TrPostProjet projet, final TrPostVisuPanel panel) { - super(MvResource.getS("Calcul des lignes de courants/trajectoires"), CtuluResource.CTULU.getIcon("crystal_oscilloscope.png"), "BILAN"); - projet_ = projet; + public TrPostActionLigneCourants(final TrPostVisuPanel panel) { + super(MvResource.getS("Calcul des lignes de courants/trajectoires"), CtuluResource.CTULU + .getIcon("crystal_oscilloscope.png"), "TRAJ"); calque_ = panel; } @Override public void actionPerformed(final ActionEvent _e) { - // -- creation du wizard depusi le calque --// - - new TrPostDialogLigneCourants(projet_, projet_.getImpl(), calque_); + new FudaaPanelTask(calque_.getCtuluUI(), new TrPostDialogLigneCourants(calque_)).afficheDialog(); } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiFlecheModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiFlecheModel.java 2008-10-30 17:10:41 UTC (rev 4123) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiFlecheModel.java 2008-10-30 17:11:11 UTC (rev 4124) @@ -14,7 +14,7 @@ import org.fudaa.dodico.ef.EfData; import org.fudaa.dodico.ef.EfDataAdapter; import org.fudaa.dodico.ef.EfGridInterface; -import org.fudaa.dodico.ef.interpolation.EfInterpolator; +import org.fudaa.dodico.ef.interpolation.EfGridDataInterpolator; import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestElt; import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestNode; import org.fudaa.dodico.h2d.H2dSiSourceInterface; @@ -81,8 +81,8 @@ final EfData vxData = new EfDataAdapter(new DoubleCollectionAdapter(_model, false), false); final EfData vyData = new EfDataAdapter(new DoubleCollectionAdapter(_model, true), false); // interpolation sur la norme et l'ange puis retransposition en vx,vy - final double vx = EfInterpolator.interpolate(idxElt, _x, _y, vxData, vyData, true, _grid); - final double vy = EfInterpolator.interpolate(idxElt, _x, _y, vxData, vyData, false, _grid); + final double vx = EfGridDataInterpolator.interpolate(idxElt, _x, _y, vxData, vyData, true, _grid); + final double vy = EfGridDataInterpolator.interpolate(idxElt, _x, _y, vxData, vyData, false, _grid); _seg.e_.x_ = _x + vx; _seg.e_.y_ = _y + vy; return true; @@ -93,7 +93,7 @@ public double getNorme(final int _i) { final double vx = getVx(_i); final double vy = getVy(_i); - return Math.sqrt(vx * vx + vy * vy); + return Math.hypot(vx, vy); } public double getVx(final int _i) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiProfileSplitter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiProfileSplitter.java 2008-10-30 17:10:41 UTC (rev 4123) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiProfileSplitter.java 2008-10-30 17:11:11 UTC (rev 4124) @@ -113,7 +113,7 @@ profil.getCoordinateSequence().getCoordinate(idxZone - 1, tmp1_); double vx = -(xAval.y - tmp1_.y); double vy = xAval.x - tmp1_.x; - double norm1 = Math.sqrt(vx * vx + vy * vy); + double norm1 = Math.hypot(vx,vy ); tmp1_.x = xAval.x + (tmp1_.x - xAval.x) / norm1; tmp1_.y = xAval.y + (tmp1_.y - xAval.y) / norm1; pi.x = tmp1_.x + vx; @@ -121,7 +121,7 @@ profil.getCoordinateSequence().getCoordinate(idxZone + 1, tmp2_); vx = -(tmp2_.y - xAval.y); vy = tmp2_.x - xAval.x; - norm1 = Math.sqrt(vx * vx + vy * vy); + norm1 = Math.hypot(vx,vy ); tmp2_.x = xAval.x + (tmp2_.x - xAval.x) / norm1; tmp2_.y = xAval.y + (tmp2_.y - xAval.y) / norm1; pii.x = tmp2_.x + vx; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiZoneOperation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiZoneOperation.java 2008-10-30 17:10:41 UTC (rev 4123) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrSiZoneOperation.java 2008-10-30 17:11:11 UTC (rev 4124) @@ -159,7 +159,7 @@ _coteEau[_tabIdx] = px_ * (_x - xAmont_) + py_ * (_y - yAmont_) + zAmont_; if (_vx != null || _vy != null) { final double h = _coteEau[_tabIdx] - _fond.getValue(_tabIdx); - final double sss = Math.sqrt(px_ * px_ + py_ * py_); + final double sss = Math.hypot(px_ ,py_); if (_vx != null) { if (h <= 0) { _vx[_tabIdx] = 0; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java 2008-10-30 17:10:41 UTC (rev 4123) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/data/TrVisuPanelEditor.java 2008-10-30 17:11:11 UTC (rev 4124) @@ -27,7 +27,7 @@ import org.fudaa.ctulu.gui.CtuluValuesEditorPanel; import org.fudaa.dodico.ef.EfGridData; import org.fudaa.dodico.ef.EfGridInterface; -import org.fudaa.dodico.ef.interpolation.EfInterpolator; +import org.fudaa.dodico.ef.interpolation.EfGridDataInterpolator; import org.fudaa.dodico.h2d.H2dParameters; import org.fudaa.dodico.h2d.H2dSIListener; import org.fudaa.dodico.h2d.H2dSiSourceInterface; @@ -395,7 +395,7 @@ public class ProfileAdapter implements MvProfileTarget { final EfGridData data_ = getParams().createGridDataAdapter(); - final EfInterpolator interpolator_ = new EfInterpolator(data_, getParams().getVectorContainer()); + final EfGridDataInterpolator interpolator_ = new EfGridDataInterpolator(data_, getParams().getVectorContainer()); public EfGridData getData() { return data_; @@ -407,7 +407,7 @@ return null; } - public EfInterpolator getInterpolator() { + public EfGridDataInterpolator getInterpolator() { return interpolator_; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostProfileAction.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostProfileAction.java 2008-10-30 17:10:41 UTC (rev 4123) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostProfileAction.java 2008-10-30 17:11:11 UTC (rev 4124) @@ -5,7 +5,7 @@ import org.fudaa.ctulu.CtuluVariable; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.dodico.ef.EfGridData; -import org.fudaa.dodico.ef.interpolation.EfInterpolator; +import org.fudaa.dodico.ef.interpolation.EfGridDataInterpolator; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; @@ -50,10 +50,10 @@ } public TrPostSource getDataSource() { - return src_; - } - - public EfInterpolator getInterpolator() { + return src_; + } + + public EfGridDataInterpolator getInterpolator() { return src_.getInterpolator(); } @@ -71,9 +71,9 @@ } - public TrPostSource getSrc_() { - return src_; - } + public TrPostSource getSrc_() { + return src_; + } } @@ -114,14 +114,12 @@ public static final ProfileAdapter createProfileAdapter(final TrPostVisuPanel _visu) { return new ProfileAdapter(_visu.getSource(), _visu.getProjet()); } - - public static final ProfileAdapter createProfileAdapter(TrPostSource src,TrPostProjet projet) { - return new ProfileAdapter(src, projet); - } + public static final ProfileAdapter createProfileAdapter(TrPostSource src, TrPostProjet projet) { + return new ProfileAdapter(src, projet); + } + protected LineString getSelectedLine() { - // pas de calque s\xE9lectionn\xE9 - if (!(panel_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { return null; } - return ((ZCalqueAffichageDonneesInterface) panel_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); + return panel_.getSelectedLine(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4290]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <had...@us...> - 2008-12-10 14:27:40
|
Revision: 4290 http://fudaa.svn.sourceforge.net/fudaa/?rev=4290&view=rev Author: hadouxad Date: 2008-12-10 14:27:36 +0000 (Wed, 10 Dec 2008) Log Message: ----------- - Correction de bugs g?\195?\170nants duplication/couper de l?\195?\169gendes. - Correction des g?\195?\169n?\195?\169rations de frames - Correction du filtre propre - Chargement de projet uniquement r?\195?\169pertoires avec filtre POST - Sauvegarde du projet avec .POST (pris en compte qu'on ajoute .POST manuellement ou non) (toutes les m?\195?\169thodes utiles sont dans TrpostFileFilter) - tentative correction bug lignes de courants: visiblement il y a des valeurs qu'il n'aime pas... - Test des valeurs null pour les legendes: update titres.... - Correction test value non null pour la ligne EfGridDataInterpolator.interpolateFromValue 180 - Compatibilit?\195?\169 maximum entre os via la methode TrPostPersistenceManager.updatePathForOs() Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFilter.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2008-12-10 14:27:03 UTC (rev 4289) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2008-12-10 14:27:36 UTC (rev 4290) @@ -60,7 +60,8 @@ title_ = _variable.toString(); time_ = _timeStep; builder_ = _builder; - res_ = builder_.createResults(_timeStep, _prog); + if(builder_!=null) + res_ = builder_.createResults(_timeStep, _prog); y_ = new TDoubleArrayList(res_.getNbIntersect()); computeY(_prog); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt =================================================================== (Binary files differ) Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-12-10 14:27:03 UTC (rev 4289) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2008-12-10 14:27:36 UTC (rev 4290) @@ -1355,15 +1355,17 @@ // // } - int idx; + /** * Cree une nouvelle fenetre dans le post contenant son jeu de layouts */ public TrPostLayoutFille createNewLayoutFrame() { + int indiceNbframes=impl_.getAllLayoutFille().size()+1; + final TrPostLayoutFille newLayoutFille = new TrPostLayoutFille(this); - newLayoutFille.setTitle(newLayoutFille.getTitle() + " N\xB0 " + (++idx)); + newLayoutFille.setTitle(newLayoutFille.getTitle() + " N\xB0 " + indiceNbframes); // addFillesLayout(newLayoutFille); impl_.addInternalFrame(newLayoutFille); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFilter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFilter.java 2008-12-10 14:27:03 UTC (rev 4289) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostFileFilter.java 2008-12-10 14:27:36 UTC (rev 4290) @@ -2,6 +2,10 @@ import java.io.File; +import javax.swing.filechooser.FileFilter; + +import org.fudaa.fudaa.tr.common.TrResource; + import com.memoire.bu.BuFileFilter; /** @@ -10,90 +14,116 @@ * @author Adrien Hadoux */ public class TrPostFileFilter extends BuFileFilter { - /** - * Utilis\xE9 pour l'extension de tous les fichiers, repertoire et ficheirs inclus. - */ - public final static String DEFAULT_EXTENSION = "POST"; + /** + * Utilis\xE9 pour l'extension de tous les fichiers, repertoire et ficheirs inclus. + */ + public final static String DEFAULT_EXTENSION = "POST"; - public TrPostFileFilter(final TrPostFileFormat _ft) { - super(new String[] { DEFAULT_EXTENSION }, _ft.getName()); - } + /** + * Filtre utilis\xE9 pour les chooser de selection de projet .POST. + * @author Adrien Hadoux + * + */ + public static class DirectoryPOSTFilter extends FileFilter{ - @Override - public boolean accept(final File _d, final String _fn) { - if (_d == null) return accept(_fn); - return accept(_d.getAbsolutePath()); - } + @Override + public boolean accept(File f) { + // TODO Auto-generated method stub + + String s = f.getName(); + + if(s.contains("."+DEFAULT_EXTENSION)) + return true; - @Override - public boolean accept(final String _f) { - if (_f == null) { return false; } - final String name = _f; - if (name == null) { return false; } - if (name.equals(TrPostPersistenceManager.setupProject)) return true; - return false; - } + return false; + } - @Override - public boolean accept(final File _f) { - if (_f == null) { return false; } - final String name = _f.getName(); - if (name == null) { return false; } - if (name.equals(TrPostPersistenceManager.setupProject)) return true; - return false; + @Override + public String getDescription() { + // TODO Auto-generated method stub + return DEFAULT_EXTENSION; + } - } - - /** - * Indique si le repertoire concern\xE9 est bien un r\xE9pertoire de type POST - * @param _f - * @return - * @author Adrien Hadoux - */ - public static boolean acceptDirectoryPOST(final File _f){ - if(!_f.isDirectory() || !_f.getName().contains("."+DEFAULT_EXTENSION)) - return false; - - //-- test du contenu si il est bien form\xE9: --// - File[] children=_f.listFiles(); - - boolean setupFound=false; - for(int i=0;!setupFound && i<children.length;i++){ - if (children[i] == null) { setupFound= false; } - else{ - final String name = children[i].getName(); - if (name == null) { setupFound= false; } - else - if (name.equals(TrPostPersistenceManager.setupProject)) setupFound= true; - } - } - - - return setupFound; - } - - /** - * Recupere le fichier setup depuis le un r\xE9pertoire de type POST - * @param _f - * @return - * @author Adrien Hadoux - */ - public static File getSetupFormDirectoryPOST(final File _f){ - File[] children=_f.listFiles(); - - - for(int i=0; i<children.length;i++){ - if (children[i] == null) {} - else{ - final String name = children[i].getName(); - if (name == null) { } - else - if (name.equals(TrPostPersistenceManager.setupProject)) return children[i]; - } - } - return null; - } - + } + public TrPostFileFilter(final TrPostFileFormat _ft) { + super(new String[] { DEFAULT_EXTENSION }, _ft.getName()); + + } + + @Override + public boolean accept(final File _d, final String _fn) { + if (_d == null) return accept(_fn); + return accept(_d.getAbsolutePath()); + } + + @Override + public boolean accept(final String _f) { + if (_f == null) { return false; } + final String name = _f; + if (name == null) { return false; } + if (name.equals(TrPostPersistenceManager.setupProject)) return true; + return false; + } + + @Override + public boolean accept(final File _f) { + if (_f == null) { return false; } + final String name = _f.getName(); + if (name == null) { return false; } + if (name.equals(TrPostPersistenceManager.setupProject)) return true; + return false; + + } + + /** + * Indique si le repertoire concern\xE9 est bien un r\xE9pertoire de type POST + * @param _f + * @return + * @author Adrien Hadoux + */ + public static boolean acceptDirectoryPOST(final File _f){ + if(!_f.isDirectory() || !_f.getName().contains("."+DEFAULT_EXTENSION)) + return false; + + //-- test du contenu si il est bien form\xE9: --// + File[] children=_f.listFiles(); + + boolean setupFound=false; + for(int i=0;!setupFound && i<children.length;i++){ + if (children[i] == null) { setupFound= false; } + else{ + final String name = children[i].getName(); + if (name == null) { setupFound= false; } + else + if (name.equals(TrPostPersistenceManager.setupProject)) setupFound= true; + } + } + + + return setupFound; + } + + /** + * Recupere le fichier setup depuis le un r\xE9pertoire de type POST + * @param _f + * @return + * @author Adrien Hadoux + */ + public static File getSetupFormDirectoryPOST(final File _f){ + File[] children=_f.listFiles(); + for(int i=0; i<children.length;i++){ + if (children[i] == null) {} + else{ + final String name = children[i].getName(); + if (name == null) { } + else + if (name.equals(TrPostPersistenceManager.setupProject)) return children[i]; + } + } + return null; + } + + } 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 2008-12-10 14:27:03 UTC (rev 4289) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java 2008-12-10 14:27:36 UTC (rev 4290) @@ -3,6 +3,7 @@ import java.awt.Dimension; import java.awt.Point; import java.io.File; +import java.io.FileFilter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; @@ -152,6 +153,7 @@ fileChooser.setDialogTitle(EbliResource.EBLI.getString("S\xE9lectionnez l'emplacement de votre projet")); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + fileChooser.addChoosableFileFilter(new TrPostFileFilter.DirectoryPOSTFilter()); if (projet_ != null){ // initialiser le saveas dans le meme rep // fileChooser.setSelectedFile(projet_); } @@ -208,6 +210,7 @@ fileChooser.setDialogTitle(EbliResource.EBLI.getString("S\xE9lectionnez l'emplacement de votre r\xE9pertoire POST")); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + fileChooser.addChoosableFileFilter(new TrPostFileFilter.DirectoryPOSTFilter()); // -- init avec les param noms projet et autre --// if (projet_ != null) { fileChooser.setSelectedFile(projet_); @@ -1337,6 +1340,23 @@ } + /** + * Methode qui se charge de modifier les paths relatifs dans les cas ou l'on sauvegarde un projet POST sous linux + * et que l'on charge ce projet sous windows. Il faut changer dynamiquement les / par des \ au chargement du projet + * @param path + * @return + */ + public static String updatePathForOs(String path){ + final String os = System.getProperty("os.name"); + if (os.startsWith("Windows")) { + path=path.replace('/', File.separatorChar); + } else { + path=path.replace('\\', File.separatorChar); + } + return path; + } + + public void writeCommentaire(OutputStream out){ } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4346]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <had...@us...> - 2009-01-12 19:51:33
|
Revision: 4346 http://fudaa.svn.sourceforge.net/fudaa/?rev=4346&view=rev Author: hadouxad Date: 2009-01-12 19:51:23 +0000 (Mon, 12 Jan 2009) Log Message: ----------- Corrections Compte rendu des 2 lots + fiches de recettes LNHE Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.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/TrPostSourceComparatorBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-01-12 19:48:55 UTC (rev 4345) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-01-12 19:51:23 UTC (rev 4346) @@ -688,7 +688,7 @@ impl_.setMainProgression(30); impl_.setMainMessage(CtuluLib.getS("Cr\xE9ation du graphe")); //on cree les evol reguliere SPECIFIQUES pour ces courbes. - FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolRegulierePourTemporelles(), null, prog,false); + FudaaCourbeImporterScope.createGraphe(target_, dataG().returnEvolRegulierePourTemporelles(xchoosen), null, prog,false); }else{ //correlation Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2009-01-12 19:48:55 UTC (rev 4345) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2009-01-12 19:51:23 UTC (rev 4346) @@ -8,6 +8,8 @@ package org.fudaa.fudaa.meshviewer.profile; import java.awt.Color; +import java.text.DecimalFormat; +import java.text.NumberFormat; import java.util.HashMap; import java.util.Map; @@ -215,7 +217,15 @@ _prog), _prog); EGCourbeChild child; if (isTime) { - model.setTitle(var.toString() + CtuluLibString.ESPACE + timeModel_.getElementAt(time[t])); + String title=var.toString() + CtuluLibString.ESPACE ; + if(var.getCommonUnit()!=null) + title+="("+var.getCommonUnit()+")"+ CtuluLibString.ESPACE ; + title+=timeModel_.getElementAt(time[t]); + //-- on ajoute les extremites du segment choisi --// + title+=", P1("+format(this.selectedLine_.getCoordinateN(0).x,2)+";"+format(this.selectedLine_.getCoordinateN(0).y,2)+")"+sep+"P"+this.selectedLine_.getNumPoints()+"("+format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints()-1).x,2)+";"+format(this.selectedLine_.getCoordinateN(this.selectedLine_.getNumPoints()-1).y,2)+")"; + + + model.setTitle(title); child = new MvProfileCourbeTime(gri, model, timeModel_); } else { child = new MvProfileCourbe(gri, model); @@ -233,6 +243,23 @@ } + + public String format(double value,int nbChiffresSignificatifs){ + + double val=0; + + String forme="#."; + + for(int i=0;i<nbChiffresSignificatifs;i++) + forme+="0"; + + DecimalFormat df = new DecimalFormat(forme); + + + + return df.format(value); + } + /** * Methode qui permet d ajouter une courbe spatiale poru un grapeh deja existant. * Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-12 19:48:55 UTC (rev 4345) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-12 19:51:23 UTC (rev 4346) @@ -20,6 +20,7 @@ import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeModel; import com.memoire.fu.FuLog; +import com.vividsolutions.jts.geom.Coordinate; /** * @author Fred Deniger @@ -160,10 +161,15 @@ final TrPostSource _src) { final TrPostCourbeModel model = new TrPostCourbeModel.Node(_src, _idxPt, _var, _src.getTime().getTimeListModel() .getTimesInSec()); - final EGCourbeChild courbe = new FudaaCourbeTime(_group, model, _src.getNewTimeListModel()); _group.addEGComponent(courbe); - courbe.getModel().setTitle(courbe.getModel().getTitle() + CtuluLibString.ESPACE + (_idxPt + 1)); + String title=courbe.getModel().getTitle()+ CtuluLibString.ESPACE ; + if(_var.getCommonUnitString()!=null) + title+="("+_var.getCommonUnitString()+")"+CtuluLibString.ESPACE; + Coordinate coor=_src.getGrid().getCoor(_idxPt); + title+= _idxPt + ":" + " (" + _src.getPrecisionModel().round(coor.x) + ", " + + _src.getPrecisionModel().round(coor.y) + ")"; + courbe.getModel().setTitle(title); return courbe; } @@ -173,7 +179,7 @@ final EGCourbeChild courbe = new FudaaCourbeTime(_group, model, _src.getNewTimeListModel()); _group.addEGComponent(courbe); courbe.getModel().setTitle( - courbe.getModel().getTitle() + " (" + _src.getPrecisionModel().round(_idxPt.getX()) + ", " + courbe.getModel().getTitle()+"("+_var.getCommonUnitString()+")" + " (" + _src.getPrecisionModel().round(_idxPt.getX()) + ", " + _src.getPrecisionModel().round(_idxPt.getY()) + ')'); return courbe; } 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-12 19:48:55 UTC (rev 4345) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-12 19:51:23 UTC (rev 4346) @@ -59,7 +59,9 @@ import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetControllerGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGrapheController; import org.fudaa.fudaa.commun.courbe.FudaaGrapheTimeAnimatedVisuPanel; import org.fudaa.fudaa.fdico.FDicoLib; import org.fudaa.fudaa.meshviewer.MvResource; @@ -915,6 +917,7 @@ final TrPostVisuPanel calque) { final EGGraphe graphe = new EGGraphe(_model); graphe.setXAxe(EGAxeHorizontal.buildDefautTimeAxe(calque.getSource().getTimeFormatter())); + graphe.getModel().getAxeX().setUnite("s"); graphe.setCmd(new CtuluCommandManager()); addEbliNode(new FudaaGrapheTimeAnimatedVisuPanel(graphe), calque); } @@ -950,11 +953,19 @@ _pn.getGraphe().restore(); if (_desc != null) nodeG.getWidget().getController().setDescription(_desc); currentLayoutFilleOrFirst.getScene().setSelectedObjects(Collections.emptySet()); + + //-- ajout syst\xE9matique de la legende associee --// + EbliWidgetControllerGraphe controller=(EbliWidgetControllerGraphe)nodeG.getWidget().getIntern().getController(); + controller.ajoutLegende(); } }); - getImpl().getCurrentLayoutFilleOrFirst().getScene().refresh(); + //getImpl().getCurrentLayoutFilleOrFirst().getScene().refresh(); + + + + } protected void buildTimeUpdater() { @@ -1132,7 +1143,7 @@ final Point location = pnVisu.getLocation(); location.x += 10; location.y += 10; - filleLayout.addCalque("Calque", location, pnVisu.getPreferredSize(), pnVisu, legendeCalque); + filleLayout.addCalque("Calque "+(filleLayout.getScene().getAllVue2d().size()+1), location, pnVisu.getPreferredSize(), pnVisu, legendeCalque); // -- decoration de la fille layout --// filleLayout.setFrameIcon(EbliResource.EBLI.getToolIcon("lissage")); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java 2009-01-12 19:48:55 UTC (rev 4345) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java 2009-01-12 19:51:23 UTC (rev 4346) @@ -224,7 +224,7 @@ final Point location = pnVisu.getLocation(); location.x += 10; location.y += 10; - impl.getCurrentLayoutFille().addCalque(TrPostSourceComparatorBuilder.getComparaisonTitle(), location, + impl.getCurrentLayoutFille().addCalque(TrPostSourceComparatorBuilder.getComparaisonTitle()+" "+impl.getCurrentLayoutFille().getScene().getAllVue2d().size()+1, location, pnVisu.getPreferredSize(), pnVisu, legendeCalque); pnVisu.restaurer(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChooseAndCreateCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChooseAndCreateCalque.java 2009-01-12 19:48:55 UTC (rev 4345) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChooseAndCreateCalque.java 2009-01-12 19:51:23 UTC (rev 4346) @@ -52,7 +52,7 @@ final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(getScene(), null); final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet_.getImpl(), projet_, legendeCalque, srcChoisie); - final EbliNode node = controller_.addCalque(TrResource.getS("Calque"), pnVisu.getLocation(), pnVisu + final EbliNode node = controller_.addCalque(TrResource.getS("Calque")+(controller_.getSceneCourante().getAllVue2d().size()+1), pnVisu.getLocation(), pnVisu .getPreferredSize(), pnVisu, legendeCalque); // -- ajout de l INFO de la source utilis\xE9e --// node.getWidget().getController().setDescription("Source: " + projet_.formatInfoSource(srcChoisie)); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java 2009-01-12 19:48:55 UTC (rev 4345) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java 2009-01-12 19:51:23 UTC (rev 4346) @@ -414,6 +414,9 @@ modelTotal.mergeWithAnotherTreeModel(modelPointsInt); } else if (modelPointsInt != null) modelTotal = modelPointsInt; + + modelTotal.getAxeX().setUnite("s"); + // -- creation du widget avec model total --// return modelTotal; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4349]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <had...@us...> - 2009-01-13 19:17:03
|
Revision: 4349 http://fudaa.svn.sourceforge.net/fudaa/?rev=4349&view=rev Author: hadouxad Date: 2009-01-13 19:16:54 +0000 (Tue, 13 Jan 2009) Log Message: ----------- fleches + persistance des donnees des courbes Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.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/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java 2009-01-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeDefautModel.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -7,6 +7,8 @@ */ package org.fudaa.fudaa.commun.courbe; +import java.util.Map; + import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluLibString; @@ -159,4 +161,16 @@ public EGModel duplicate() { return new FudaaCourbeDefautModel(this.e_.getCopy(this.e_.getListener())); } + +@Override +public Object getPersistSpecificDatas() { + // TODO Auto-generated method stub + return null; +} + +@Override +public void setPersistSpecificDatas(Object data, Map infos) { + // TODO Auto-generated method stub + +} } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2009-01-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeTimeModel.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -7,6 +7,8 @@ */ package org.fudaa.fudaa.commun.courbe; +import java.util.Map; + import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluListSelectionInterface; @@ -37,6 +39,13 @@ time_ = _timeIdx; } + /** + * ACHTUNG!!!; constructeur utilis\xE9 uniquement pour la persistance des donnees!!! + */ + public FudaaCourbeTimeModel(){ + + } + public void fillWithInfo(InfoData _table, CtuluListSelectionInterface _selectedPt) {} protected void clearCache() { @@ -209,4 +218,18 @@ return duplic; } +@Override +public Object getPersistSpecificDatas() { + // TODO Auto-generated method stub + return null; +} + +@Override +public void setPersistSpecificDatas(Object data, Map infos) { + // TODO Auto-generated method stub + +} + + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -7,6 +7,8 @@ */ package org.fudaa.fudaa.meshviewer.profile; +import java.util.Map; + import gnu.trove.TDoubleArrayList; import org.fudaa.ctulu.CtuluCommandContainer; @@ -240,4 +242,16 @@ } } +@Override +public Object getPersistSpecificDatas() { + // TODO Auto-generated method stub + return null; } + +@Override +public void setPersistSpecificDatas(Object data, Map infos) { + // TODO Auto-generated method stub + +} + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java 2009-01-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileCoordinatesModel.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -7,6 +7,8 @@ */ package org.fudaa.fudaa.meshviewer.profile; +import java.util.Map; + import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluListSelectionInterface; import org.fudaa.ctulu.ProgressionInterface; @@ -188,4 +190,16 @@ return duplic; } +@Override +public Object getPersistSpecificDatas() { + // TODO Auto-generated method stub + return null; } + +@Override +public void setPersistSpecificDatas(Object data, Map infos) { + // TODO Auto-generated method stub + +} + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -8,6 +8,8 @@ package org.fudaa.fudaa.tr.post; import java.io.IOException; +import java.util.ArrayList; +import java.util.Map; import java.util.Set; import org.fudaa.ctulu.CtuluCommandContainer; @@ -28,221 +30,321 @@ */ public abstract class TrPostCourbeModel extends FudaaCourbeTimeModel { - /** - * @return the source - */ - public TrPostSource getSource() { - return source_; - } + /** + * @return the source + */ + public TrPostSource getSource() { + return source_; + } - /** - * source utilisee par la courbe - */ - public TrPostSource source_; + /** + * source utilisee par la courbe + */ + public TrPostSource source_; - public final static class Interpolated extends TrPostCourbeModel { + public final static class Interpolated extends TrPostCourbeModel { - final TrPostInterpolatePoint ptIdx_; + TrPostInterpolatePoint ptIdx_; - /** - * @param _ptIdx - * @param _varIdx - * @param _timeIdx - */ - public Interpolated(final TrPostSource _src, final TrPostInterpolatePoint _ptIdx, final H2dVariableType _varIdx) { - super(_src, _varIdx, _src.getTime().getTimeListModel().getTimesInSec()); - ptIdx_ = _ptIdx; - } + + /** + * ACHTUNG: constructeur utilis\xE9 uniquement pour la persistance des donn\xE9es!!! + */ + public Interpolated(){ + super(); + } + + + /** + * @param _ptIdx + * @param _varIdx + * @param _timeIdx + */ + public Interpolated(final TrPostSource _src, final TrPostInterpolatePoint _ptIdx, final H2dVariableType _varIdx) { + super(_src, _varIdx, _src.getTime().getTimeListModel().getTimesInSec()); + ptIdx_ = _ptIdx; + } - @Override - public double getPtX() { - return ptIdx_.getX(); - } + @Override + public double getPtX() { + return ptIdx_.getX(); + } - @Override - public double getPtY() { - return ptIdx_.getY(); - } + @Override + public double getPtY() { + return ptIdx_.getY(); + } - @Override - protected void updateY() { - createY(); - for (int i = 0; i < y_.length; i++) { - final EfData data = source_.getData(var_, i); - if (data == null) { - FuLog.warning("TRP: data is null for " + var_); - super.y_[i] = ptIdx_.getInterpolateValue(getVar(), data, i, source_); - } - } - } + @Override + protected void updateY() { + createY(); + for (int i = 0; i < y_.length; i++) { + final EfData data = source_.getData(var_, i); + if (data == null) { + FuLog.warning("TRP: data is null for " + var_); + super.y_[i] = ptIdx_.getInterpolateValue(getVar(), data, i, source_); + } + } + } - public TrPostInterpolatePoint getInterpolatePt() { - return ptIdx_; - } + public TrPostInterpolatePoint getInterpolatePt() { + return ptIdx_; + } - @Override - public boolean isCourbeForInterpolation(final TrPostInterpolatePoint _int) { - return ptIdx_.equals(_int); - } + @Override + public boolean isCourbeForInterpolation(final TrPostInterpolatePoint _int) { + return ptIdx_.equals(_int); + } - @Override - public boolean isCourbeForObject(final int _idxObj) { - return false; - } + @Override + public boolean isCourbeForObject(final int _idxObj) { + return false; + } - } + @Override + public Object getSelectionPoint() { + // TODO Auto-generated method stub + return ptIdx_; + } - public final static class Node extends TrPostCourbeModel { + @Override + public void setSelectionPoint(Object point) { + // TODO Auto-generated method stub + if(point!=null && (point instanceof TrPostInterpolatePoint)) + ptIdx_=(TrPostInterpolatePoint) point; + } - final int ptIdx_; + } - /** - * @param _ptIdx - * @param _varIdx - * @param _timeIdx - */ - public Node(final TrPostSource _src, final int _ptIdx, final H2dVariableType _varIdx, final double[] _timeIdx) { - super(_src, _varIdx, _timeIdx); - ptIdx_ = _ptIdx; - } + public final static class Node extends TrPostCourbeModel { - @Override - protected void updateY() { - createY(); - for (int i = 0; i < y_.length; i++) { - // final EfData data = source_.getData(var_, i); - // if (data == null) { - // FuLog.warning("TRP: data is null for " + var_); - try { - super.y_[i] = source_.getData(var_, i, ptIdx_); - } catch (final IOException e) { - FuLog.error(e); - } - // } - } - // final EfData data = source_.getData(_var, _timeIdx); - // if (data == null) { - // FuLog.warning("TRP: data is null for " + _var); - // } - // super.y_[_timeIdx] = data.getValue(ptIdx_); + int ptIdx_; - } + /** + * @param _ptIdx + * @param _varIdx + * @param _timeIdx + */ + public Node(final TrPostSource _src, final int _ptIdx, final H2dVariableType _varIdx, final double[] _timeIdx) { + super(_src, _varIdx, _timeIdx); + ptIdx_ = _ptIdx; + } - @Override - public double getPtX() { - // FIXME RUBAR - return source_.isElementVar(getVar()) ? source_.getGrid().getCentreXElement(ptIdx_) : source_.getGrid().getPtX( - ptIdx_); - } + + /** + * ACHTUNG: constructeur utilis\xE9 uniquement pour la persistance des donn\xE9es!!! + */ + public Node(){ + super(); + } + + @Override + protected void updateY() { + createY(); + for (int i = 0; i < y_.length; i++) { + // final EfData data = source_.getData(var_, i); + // if (data == null) { + // FuLog.warning("TRP: data is null for " + var_); + try { + super.y_[i] = source_.getData(var_, i, ptIdx_); + } catch (final IOException e) { + FuLog.error(e); + } + // } + } + // final EfData data = source_.getData(_var, _timeIdx); + // if (data == null) { + // FuLog.warning("TRP: data is null for " + _var); + // } + // super.y_[_timeIdx] = data.getValue(ptIdx_); - @Override - public double getPtY() { - return source_.isElementVar(getVar()) ? source_.getGrid().getCentreYElement(ptIdx_) : source_.getGrid().getPtY( - ptIdx_); - } + } - public int getPtIdx() { - return ptIdx_; - } + @Override + public double getPtX() { + // FIXME RUBAR + return source_.isElementVar(getVar()) ? source_.getGrid().getCentreXElement(ptIdx_) : source_.getGrid().getPtX( + ptIdx_); + } - @Override - public boolean isCourbeForInterpolation(final TrPostInterpolatePoint _int) { - return false; - } + @Override + public double getPtY() { + return source_.isElementVar(getVar()) ? source_.getGrid().getCentreYElement(ptIdx_) : source_.getGrid().getPtY( + ptIdx_); + } - @Override - public boolean isCourbeForObject(final int _idxObj) { - return _idxObj == ptIdx_; - } + public int getPtIdx() { + return ptIdx_; + } - } + @Override + public boolean isCourbeForInterpolation(final TrPostInterpolatePoint _int) { + return false; + } - public static EGCourbeChild buildCourbeModel(final H2dVariableType _var, final int _idxPt, final EGGroup _group, - final TrPostSource _src) { - final TrPostCourbeModel model = new TrPostCourbeModel.Node(_src, _idxPt, _var, _src.getTime().getTimeListModel() - .getTimesInSec()); - final EGCourbeChild courbe = new FudaaCourbeTime(_group, model, _src.getNewTimeListModel()); - _group.addEGComponent(courbe); - String title=courbe.getModel().getTitle()+ CtuluLibString.ESPACE ; - if(_var.getCommonUnitString()!=null) - title+="("+_var.getCommonUnitString()+")"+CtuluLibString.ESPACE; - Coordinate coor=_src.getGrid().getCoor(_idxPt); - title+= _idxPt + ":" + " (" + _src.getPrecisionModel().round(coor.x) + ", " - + _src.getPrecisionModel().round(coor.y) + ")"; - courbe.getModel().setTitle(title); - return courbe; - } + @Override + public boolean isCourbeForObject(final int _idxObj) { + return _idxObj == ptIdx_; + } - public static EGCourbeChild buildCourbeModel(final H2dVariableType _var, final TrPostInterpolatePoint _idxPt, - final EGGroup _group, final TrPostSource _src) { - final TrPostCourbeModel model = new TrPostCourbeModel.Interpolated(_src, _idxPt, _var); - final EGCourbeChild courbe = new FudaaCourbeTime(_group, model, _src.getNewTimeListModel()); - _group.addEGComponent(courbe); - courbe.getModel().setTitle( - courbe.getModel().getTitle()+"("+_var.getCommonUnitString()+")" + " (" + _src.getPrecisionModel().round(_idxPt.getX()) + ", " - + _src.getPrecisionModel().round(_idxPt.getY()) + ')'); - return courbe; - } + @Override + public Object getSelectionPoint() { + // TODO Auto-generated method stub + return new Integer(ptIdx_); + } - H2dVariableType var_; + @Override + public void setSelectionPoint(Object point) { + // TODO Auto-generated method stub + if(point!=null && (point instanceof Integer)) + ptIdx_=((Integer)point).intValue(); + } - public TrPostCourbeModel(final TrPostSource _src, final H2dVariableType _varIdx, final double[] _timeIdx) { - super(_timeIdx); - source_ = _src; - var_ = _varIdx; - } + } - protected final void setVar(final H2dVariableType _t) { - var_ = _t; - } + public static EGCourbeChild buildCourbeModel(final H2dVariableType _var, final int _idxPt, final EGGroup _group, + final TrPostSource _src) { + final TrPostCourbeModel model = new TrPostCourbeModel.Node(_src, _idxPt, _var, _src.getTime().getTimeListModel() + .getTimesInSec()); + final EGCourbeChild courbe = new FudaaCourbeTime(_group, model, _src.getNewTimeListModel()); + _group.addEGComponent(courbe); + String title=courbe.getModel().getTitle()+ CtuluLibString.ESPACE ; + if(_var.getCommonUnitString()!=null) + title+="("+_var.getCommonUnitString()+")"+CtuluLibString.ESPACE; + Coordinate coor=_src.getGrid().getCoor(_idxPt); + title+= _idxPt + ":" + " (" + _src.getPrecisionModel().round(coor.x) + ", " + + _src.getPrecisionModel().round(coor.y) + ")"; + courbe.getModel().setTitle(title); + return courbe; + } - public boolean clearCache(final H2dVariableType _varChanged, final Set _varUsingModifiedVar) { - if (var_ == _varChanged || (_varUsingModifiedVar != null) && _varUsingModifiedVar.contains(var_)) { - clearCache(); - return true; - } - return false; - } + public static EGCourbeChild buildCourbeModel(final H2dVariableType _var, final TrPostInterpolatePoint _idxPt, + final EGGroup _group, final TrPostSource _src) { + final TrPostCourbeModel model = new TrPostCourbeModel.Interpolated(_src, _idxPt, _var); + final EGCourbeChild courbe = new FudaaCourbeTime(_group, model, _src.getNewTimeListModel()); + _group.addEGComponent(courbe); + courbe.getModel().setTitle( + courbe.getModel().getTitle()+"("+_var.getCommonUnitString()+")" + " (" + _src.getPrecisionModel().round(_idxPt.getX()) + ", " + + _src.getPrecisionModel().round(_idxPt.getY()) + ')'); + return courbe; + } - @Override - public boolean deplace(final int[] _selectIdx, final double _deltaX, final double _deltaY, - final CtuluCommandContainer _cmd) { - return false; - } + H2dVariableType var_; - protected abstract void updateY(); + public TrPostCourbeModel(final TrPostSource _src, final H2dVariableType _varIdx, final double[] _timeIdx) { + super(_timeIdx); + source_ = _src; + var_ = _varIdx; + } + + /** + * ACTHUNG: constructeur utilis\xE9 uniquement pour la persistance des donn\xE9es!!! + */ + public TrPostCourbeModel(){ + super(); + } - @Override - public String getTitle() { - return nom_ == null ? var_.getName() : nom_; - } + protected final void setVar(final H2dVariableType _t) { + var_ = _t; + } - public final H2dVariableType getVar() { - return var_; - } + public boolean clearCache(final H2dVariableType _varChanged, final Set _varUsingModifiedVar) { + if (var_ == _varChanged || (_varUsingModifiedVar != null) && _varUsingModifiedVar.contains(var_)) { + clearCache(); + return true; + } + return false; + } - public abstract double getPtX(); + @Override + public boolean deplace(final int[] _selectIdx, final double _deltaX, final double _deltaY, + final CtuluCommandContainer _cmd) { + return false; + } - public abstract double getPtY(); + protected abstract void updateY(); - public abstract boolean isCourbeForInterpolation(TrPostInterpolatePoint _int); + @Override + public String getTitle() { + return nom_ == null ? var_.getName() : nom_; + } - public abstract boolean isCourbeForObject(int _idxObj); + public final H2dVariableType getVar() { + return var_; + } - @Override - public boolean isRemovable() { - return true; - } + public abstract double getPtX(); - @Override - public boolean isDuplicatable() { - return true; - } + public abstract double getPtY(); - protected void createY() { - if (y_ == null || y_.length != this.source_.getNbTimeStep()) { - y_ = new double[source_.getNbTimeStep()]; - } - } + public abstract boolean isCourbeForInterpolation(TrPostInterpolatePoint _int); + public abstract boolean isCourbeForObject(int _idxObj); + + @Override + public boolean isRemovable() { + return true; + } + + @Override + public boolean isDuplicatable() { + return true; + } + + protected void createY() { + if (y_ == null || y_.length != this.source_.getNbTimeStep()) { + y_ = new double[source_.getNbTimeStep()]; + } + } + + @Override + public Object getPersistSpecificDatas() { + + //-- retourne le quatuor point, pdt,variable et fichier source + ArrayList<Object> listeData=new ArrayList<Object>(); + listeData.add(this.source_.getId()); + listeData.add(this.getTime()); + listeData.add(this.var_); + //-- recupere le noeud ou point interpol\xE9 --// + listeData.add(getSelectionPoint()); + return listeData; + } + + public abstract Object getSelectionPoint(); + public abstract void setSelectionPoint(Object point); + + @Override + public void setPersistSpecificDatas(Object data, Map infos) { + + if(data ==null || !(data instanceof ArrayList))return; + + ArrayList<Object> liste=(ArrayList<Object>)data; + + + String idSource=(String) liste.get(0); + TrPostProjet projet = (TrPostProjet) infos.get("TrPostProjet"); + + if (projet != null){ + // -- etape 1: recherche du source qui contient le path donn\xE9 --// + TrPostSource src = projet.findSourceById(idSource); + if(src!=null) + this.source_=src; + + } + // -- etape 2:times --// + double[] times=(double[]) liste.get(1); + if(times!=null) + this.setTime(times); + + // -- etape 3:variable --// + H2dVariableType var=(H2dVariableType) liste.get(2); + if(var!=null) + this.var_=var; + + Object point=liste.get(3); + if(point!=null) + setSelectionPoint(point); + + } + } \ No newline at end of file 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-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -39,6 +39,7 @@ import org.fudaa.ebli.courbe.EGGrapheModel; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; +import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.fudaa.commun.courbe.FudaaCourbeModel; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter.Target; @@ -945,6 +946,26 @@ return duplic; } + + /** + * Methode qui affiche les infos principales de la courbe choisie + * @return + */ + public String getSelectedSpecificCourbeInfos(){ + + if(this.getSelectedObject() instanceof EGCourbe){ + + EGModel model=((EGCourbe)this.getSelectedObject() ).getModel(); + + //-- on utilise les fillWithInfo pour preciser les infos de courbe entre les 2 tableaux des courbes. + //model.fillWithInfo(_table, _selectedPt); + return model.getPersistSpecificDatas().toString(); + + } + else return null; + } + + @Override public Object getSpecificPersitDatas(Map Params) { // TODO Auto-generated method stub @@ -956,7 +977,7 @@ } @Override - public void setSpecificPersitDatas(final Object specPersitData, Map params) { + public void setSpecificPersitDatas(final Object specPersitData, Map infos) { // TODO Auto-generated method stub TrPostCourbeTreeModelPersist data = (TrPostCourbeTreeModelPersist) specPersitData; @@ -964,7 +985,7 @@ data.fillModelWith(this); // -- recuperation du trpostprojet specifique au chargement --// - TrPostProjet projet = (TrPostProjet) params.get("TrPostProjet"); + TrPostProjet projet = (TrPostProjet) infos.get("TrPostProjet"); this.projet_ = projet; this.impl_ = projet.impl_; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2009-01-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -44,6 +44,7 @@ import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorArrowEditor; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorTextEditor; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; @@ -498,7 +499,19 @@ setTitle(previousTitleFrame); } + //-- cas des fleches + else if (node.getCreator() instanceof EbliWidgetCreatorArrowEditor) { + FuLog.debug("arrow editor"); + + // -- etape 1: on fout eventuellement le tree des layouts --// + changeTree(getScene()); + // -- etape 2: rechargement de la toolbar specifique dans this --// + changeToolbar(node.getWidget().getController()); + setTitle(previousTitleFrame); + } + + else { // -- etape 1: on fout eventuellement le tree des layouts --// changeTree(getScene()); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-01-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -28,12 +28,14 @@ import org.fudaa.ebli.commun.EbliActionPaletteAbstract; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliComponentFactory; +import org.fudaa.ebli.commun.EbliEditorArrow; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliNodeDefault; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.EbliWidgetArrowEditor; import org.fudaa.ebli.visuallibrary.EbliWidgetBordureSingle; import org.fudaa.ebli.visuallibrary.actions.CommandUndoRedoCreation; import org.fudaa.ebli.visuallibrary.actions.EbliWidgetActionAlign; @@ -52,6 +54,7 @@ import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorLegende; import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; +import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorArrowEditor; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorShape; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorTextLabel; import org.fudaa.ebli.visuallibrary.creator.ShapeCreatorCircle; @@ -331,13 +334,19 @@ // -- ajout du rectangle --// final EbliNodeDefault nodeFleche = new EbliNodeDefault(); nodeFleche.setTitle("Fleche simple"); - nodeFleche.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFlecheSimple())); - nodeFleche.setPreferedSize(new Dimension(100, 50)); + //nodeFleche.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFlecheSimple())); + + nodeFleche.setCreator(new EbliWidgetCreatorArrowEditor(new EbliEditorArrow())); + + nodeFleche.setPreferedSize(new Dimension(200, 150)); nodeFleche.setPreferedLocation(new Point(350, 125)); // ajout du node au layout addNode(nodeFleche); + //nodeFleche.getWidget().repaint(); + //((EbliWidgetArrowEditor)nodeFleche.getWidget()).editor_.creationFlecheClassique(); + return nodeFleche; } @@ -429,7 +438,7 @@ }); // -- palette fleche simple--// - _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Fleche"), + _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Editeur Fleche"), EbliResource.EBLI.getToolIcon("crystal_bu_link"), "WIDGETFLECHESIMPLE") { @Override public void actionPerformed(final ActionEvent _evt) { 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-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -103,6 +103,9 @@ */ public class TrPostProjet implements ActionListener { + + public final static boolean AMELIO_LOT_VISIBLE=true; + /** * Manager de sauvegarder/charghement des donn\xE9es */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java 2009-01-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacBoundaryCourbeModel.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -7,6 +7,8 @@ */ package org.fudaa.fudaa.tr.telemac; +import java.util.Map; + import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluListSelectionInterface; @@ -244,4 +246,16 @@ } +@Override +public Object getPersistSpecificDatas() { + // TODO Auto-generated method stub + return null; +} + +@Override +public void setPersistSpecificDatas(Object data, Map infos) { + // TODO Auto-generated method stub + +} + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java 2009-01-13 19:15:33 UTC (rev 4348) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/telemac/TrTelemacWeirCourbeModel.java 2009-01-13 19:16:54 UTC (rev 4349) @@ -7,6 +7,8 @@ */ package org.fudaa.fudaa.tr.telemac; +import java.util.Map; + import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluLibArray; import org.fudaa.ctulu.CtuluListSelectionInterface; @@ -165,4 +167,16 @@ public EGModel duplicate() { return new TrTelemacWeirCourbeModel(this.i_, this.mng_, this.cote_, CtuluLibArray.copy(this.x_)); } + +@Override +public Object getPersistSpecificDatas() { + // TODO Auto-generated method stub + return null; +} + +@Override +public void setPersistSpecificDatas(Object data, Map infos) { + // TODO Auto-generated method stub + +} } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4386]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <had...@us...> - 2009-01-20 19:35:51
|
Revision: 4386 http://fudaa.svn.sourceforge.net/fudaa/?rev=4386&view=rev Author: hadouxad Date: 2009-01-20 19:35:40 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.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/TrPostVisuPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardProfilSpatial.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-20 19:33:53 UTC (rev 4385) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-20 19:35:40 UTC (rev 4386) @@ -26,10 +26,12 @@ import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.ebli.calque.BCalqueLegende; +import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.palette.BPaletteInfo.InfoData; import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; +import org.fudaa.fudaa.tr.post.TrPostCourbeTreeModel; import org.fudaa.fudaa.tr.post.TrPostProjet; import org.fudaa.fudaa.tr.post.TrPostSource; import org.fudaa.fudaa.tr.post.TrPostVisuPanel; @@ -234,8 +236,9 @@ return res_.getIntersect(_i).isRealIntersection(); } + public boolean isRemovable_=false; public boolean isRemovable() { - return false; + return isRemovable_; } public boolean isSegmentDrawn(final int _i) { @@ -402,7 +405,7 @@ TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrReplayCurvesData.getInstance().constructProfilSpatialOrigine(this, implementation); + TrReplayCurvesData.getInstance().getProfilSpatialOrigine(this, implementation); } @@ -421,7 +424,20 @@ public void setBuilder(EfLineIntersectionsResultsBuilder _builder) { this.builder_ = _builder; } + + + public void replayData(org.fudaa.ebli.courbe.EGGrapheTreeModel model,Map infos, CtuluUI impl) { + if(!(impl instanceof TrPostCommonImplementation)){ + impl.error(TrResource.getS("Impossible de r\xE9cup\xE9rer la bonne interface fudaa")); + return; + } + TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; + + //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// + TrReplayCurvesData.getInstance().getProfilSpatialReplayData((MvProfileTreeModel)model, this, implementation); + + } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2009-01-20 19:33:53 UTC (rev 4385) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileBuilder.java 2009-01-20 19:35:40 UTC (rev 4386) @@ -246,18 +246,10 @@ public String format(double value,int nbChiffresSignificatifs){ - - double val=0; - String forme="#."; - for(int i=0;i<nbChiffresSignificatifs;i++) forme+="0"; - DecimalFormat df = new DecimalFormat(forme); - - - return df.format(value); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-01-20 19:33:53 UTC (rev 4385) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-01-20 19:35:40 UTC (rev 4386) @@ -10,6 +10,7 @@ import java.awt.Color; import java.awt.Component; import java.awt.EventQueue; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -31,6 +32,7 @@ import org.fudaa.ctulu.CtuluVariable; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ctulu.gis.GISZoneCollectionPoint; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.ef.operation.EfLineIntersection; @@ -42,6 +44,7 @@ import org.fudaa.dodico.h2d.type.H2dVariableType; import org.fudaa.dodico.mesure.EvolutionReguliere; import org.fudaa.dodico.mesure.EvolutionReguliereInterface; +import org.fudaa.ebli.calque.BCalqueLegende; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.courbe.EGActionReplayDataCourbe; import org.fudaa.ebli.courbe.EGAxeVertical; @@ -53,6 +56,7 @@ import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.courbe.EGObject; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.fudaa.commun.courbe.FudaaCourbeModel; import org.fudaa.fudaa.commun.courbe.FudaaCourbeTimeListModel; import org.fudaa.fudaa.commun.courbe.ScopeCourbeModel; @@ -61,15 +65,19 @@ import org.fudaa.fudaa.meshviewer.export.MvExportChooseVarAndTime; import org.fudaa.fudaa.tr.post.ScopCourbeTreeModel; +import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; import org.fudaa.fudaa.tr.post.TrPostCourbeModel; import org.fudaa.fudaa.tr.post.TrPostProjet; import org.fudaa.fudaa.tr.post.TrPostSource; +import org.fudaa.fudaa.tr.post.TrPostVisuPanel; import org.fudaa.fudaa.tr.post.actions.TrPostProfileAction; import com.memoire.bu.BuLib; import com.memoire.bu.BuResource; import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.LineString; /** @@ -83,17 +91,17 @@ EfLineIntersectionsResultsBuilder builderMesh_; EfLineIntersectionsResultsMng resMesh_; - EfLineIntersectionsCorrectionTester tester_; - - /** - * Ligne initialement utilis\xE9e pour la creation de la courbe - */ - LineString initLineNode; - LineString initLineMesh; - - - public MvProfileTarget target_; + EfLineIntersectionsCorrectionTester tester_; + /** + * Ligne initialement utilis\xE9e pour la creation de la courbe + */ + LineString initLineNode; + LineString initLineMesh; + + + public MvProfileTarget target_; + public MvProfileTreeModel(final MvProfileTarget _target, final EfLineIntersectionsCorrectionTester _tester) { super(); timeModel_ = _target.getTimeModel(); @@ -123,8 +131,8 @@ builderNode_ = _builderNode; if(builderNode_!=null ) initLineNode=builderNode_.getInitLine_(); - - + + } public EfLineIntersectionsResultsBuilder getBuilderFor(final CtuluVariable _v) { @@ -192,6 +200,105 @@ } + /** + * Rejoue les donn\xE9es de la polyligne avec les nouvelles infos. + * Si boolean ecraser est a false, Cree sune nouvelle courbe avec le mod\xE8le qui convient. + * Dans le cas ou ecraser est \xE0 true, on ecrase les infos du modele par ceux des param d'entree. + * Version r\xE9serv\xE9s aux points r\xE9els + * @param _model + * @param _src + * @param _idxToAdd + * @param _cmd + * @param _prog + * @param newVariable + * @param ecraser + */ + public void replayPoints(TrPostCommonImplementation impl,TrPostVisuPanel vue2d,MVProfileCourbeModel _model,final TrPostSource _src, final int[] _idxToAdd, final CtuluCommandContainer _cmd, + final ProgressionInterface _prog, H2dVariableType newVariable,int newTimeStep, boolean ecraser) { + + //-- ajout de la variable --// + final MvProfileCourbeGroup groupVar = getGroup(newVariable, true); + + + //-- creation de la polyligne --// + GISZoneCollectionPoint points=new GISZoneCollectionPoint(); + for(int i=0;i<_idxToAdd.length;i++) + points.add(_src.getGrid().getPtX(_idxToAdd[i]),_src.getGrid().getPtY(_idxToAdd[i]),0); + LineString polyligne=new LineString(points,new GeometryFactory()); + + + //-- on cree la nouvelle courbe pour la variable correspondante --// + MvProfileTarget target=new TrPostProfileAction.ProfileAdapter(_src,impl.getCurrentProject()); + MvProfileBuilder builder=new MvProfileBuilderFromLine(target,impl,polyligne,vue2d,new MvProfileCoteTester()); + //-- intersectionResultI --// + EfLineIntersectionsResultsI res=builder.getDefaultRes(_model.variable_, impl.getMainProgression()); + //-- EfLineIntersectionsResultsBuilder --// + EfLineIntersectionsResultsBuilder efbuilder=new EfLineIntersectionsResultsBuilder(polyligne,_model.res_,new MvProfileCoteTester()); + MVProfileCourbeModel newModele=new MVProfileCourbeModel(newVariable,_src,newTimeStep,efbuilder,impl.getMainProgression()); + + //-- titre --// + String title=newVariable.toString() + CtuluLibString.ESPACE ; + if(newVariable.getCommonUnit()!=null) + title+="("+newVariable.getCommonUnit()+")"+ CtuluLibString.ESPACE ; + title+=_src.getTimeStep(newTimeStep); + //-- on ajoute les extremites du segment choisi --// + title+=", P1("+format(polyligne.getCoordinateN(0).x,2)+";"+format(polyligne.getCoordinateN(0).y,2)+")"+";"+"P"+polyligne.getNumPoints()+"("+format(polyligne.getCoordinateN(polyligne.getNumPoints()-1).x,2)+";"+format(polyligne.getCoordinateN(polyligne.getNumPoints()-1).y,2)+")"; + newModele.setTitle(title); + + //-- creation de la nouvelle courbe --// + MvProfileCourbeTime newchild = new MvProfileCourbeTime(groupVar, newModele, target.getTimeModel()); + groupVar.addEGComponent(newchild); + + + //-- si ecraser, on supprime la courbe --// + if(ecraser){ + this.removeModele(_model,_cmd); + + } + + + fireStructureChanged(); + + } + + /** + * Methode qui supprime la courbe pour son modele du profil spatial. + * Supprime \xE9galement le groupe de variable si ce dernier ne contient pas d'autres courbes. + * @param model de la courbe a supprimer + * @param mng + */ + public void removeModele(MVProfileCourbeModel model,CtuluCommandContainer mng){ + model.isRemovable_=true; + //-- on recupere le groupe du modele --// + final MvProfileCourbeGroup groupVar = getGroup(model.getVariable(), false); + EGCourbeChild[] liste=new EGCourbeChild[1]; + boolean trouve=false; + for (int i = groupVar.getChildCount() - 1;!trouve && i >= 0; i--) { + final MVProfileCourbeModel res = (MVProfileCourbeModel) groupVar.getCourbeAt(i).getModel(); + if (res==model) { + liste[0]=groupVar.getCourbeAt(i); + trouve=true; + } + } + if(trouve) + removeCurves(liste,mng ); + + //-- test si le groupe ne contient rien, on le degage --// + if(groupVar.getEGChilds()==null || groupVar.getEGChilds().length==0){ + this.remove(groupVar); + + } + } + + public String format(double value,int nbChiffresSignificatifs){ + String forme="#."; + for(int i=0;i<nbChiffresSignificatifs;i++) + forme+="0"; + DecimalFormat df = new DecimalFormat(forme); + return df.format(value); + } + + MvProfileGridPalette paletteGrid_; public EfLineIntersectionsResultsI[] getDefaultRes() { @@ -646,7 +753,7 @@ } - + /** * Methode qui permet de fusionner le model courant avec un autre model. Utilsier poru la fusion de courbes spatiales * et l ajout dans d autres courbes. @@ -656,31 +763,31 @@ */ public void mergeWithAnotherScopeTreeModel(final ScopCourbeTreeModel anotherModel) { // -- parcours de la liste des variables du graphe a fusionner --// - - - // -- on recherche le group associe a la variale dans l autre graphe - // sinon on le cree --// - final MvProfileCourbeGroup group = this.getGroup(H2dVariableType.SANS, true); - - // -- on recupere toutes les courbes associees a la var pour le - // graphe merges - - final EGGroup g = anotherModel.getGroupFor(H2dVariableType.SANS); - for (int i = g.getChildCount() - 1; i >= 0; i--) { - if (g.getCourbeAt(i).getModel() instanceof ScopeCourbeModel) { - - group.addEGComponent((EGCourbeChild) g.getCourbeAt(i).duplicate(group, new EGGrapheDuplicator())); - - } + // -- on recherche le group associe a la variale dans l autre graphe + // sinon on le cree --// + final MvProfileCourbeGroup group = this.getGroup(H2dVariableType.SANS, true); - } + + // -- on recupere toutes les courbes associees a la var pour le + // graphe merges + + final EGGroup g = anotherModel.getGroupFor(H2dVariableType.SANS); + for (int i = g.getChildCount() - 1; i >= 0; i--) { + if (g.getCourbeAt(i).getModel() instanceof ScopeCourbeModel) { + + + group.addEGComponent((EGCourbeChild) g.getCourbeAt(i).duplicate(group, new EGGrapheDuplicator())); + + } + + } this.fireStructureChanged(); } - + protected MvProfileGridPalette getPaletteGrid() { return paletteGrid_; } @@ -698,10 +805,10 @@ final List<EGCourbeChild> childs = new ArrayList<EGCourbeChild>(_crb.length); for (int i = 0; i < _crb.length; i++) { final EGCourbeChild child = new EGCourbeChild(gr, new FudaaCourbeModel(new EvolutionReguliere(_crb[i]))); - + //-- on met a jour si la courbe est un nuage de points ou non --// child.setNuagePoints_(_crb[i].isNuagePoints()); - + childs.add(child); gr.addEGComponent(child); } @@ -713,66 +820,67 @@ } - - public void finalizePersistance(){ - - //-- recupere les groupes de la persistance qui doivent etre supprim\xE9 car ne sont pas des liens directs avec les variables H2dVariableType du projet--// + + public void finalizePersistance(){ + + //-- recupere les groupes de la persistance qui doivent etre supprim\xE9 car ne sont pas des liens directs avec les variables H2dVariableType du projet--// ArrayList<EGGroup> listeGroupeAsupprimer=new ArrayList<EGGroup>(); - - - for(int i=0;i<this.getNbEGObject();i++){ - EGObject eg=this.getEGObject(i); - if((this.getEGObject(i) instanceof EGGroup) && !(this.getEGObject(i) instanceof MvProfileCourbeGroup)){ - - EGGroup groupe=(EGGroup) this.getEGObject(i); - ArrayList<EGCourbeChild> listeCourbeToAdd=new ArrayList<EGCourbeChild>(); - MvProfileCourbeGroup nvGroupe=null; - for(int k=0;k<groupe.getChildCount();k++){ + + + for(int i=0;i<this.getNbEGObject();i++){ + EGObject eg=this.getEGObject(i); + if((this.getEGObject(i) instanceof EGGroup) && !(this.getEGObject(i) instanceof MvProfileCourbeGroup)){ + + EGGroup groupe=(EGGroup) this.getEGObject(i); + ArrayList<EGCourbeChild> listeCourbeToAdd=new ArrayList<EGCourbeChild>(); + MvProfileCourbeGroup nvGroupe=null; + for(int k=0;k<groupe.getChildCount();k++){ if(groupe.getCourbeAt(k)!=null){ EGCourbeChild courbe=groupe.getCourbeAt(k); - + if(courbe.getModel()!=null && (courbe.getModel() instanceof MVProfileCourbeModel)){ // List childrens=groupe.getChildren(); MVProfileCourbeModel model=(MVProfileCourbeModel) courbe.getModel(); //-- recherche ou creation du bon groupe correspondant--// - nvGroupe=getGroup(model.variable_,true); + nvGroupe=getGroup(model.variable_,true); //nvGroupe.addEGComponent(courbe); - + listeCourbeToAdd.add(courbe); - - + + }else{ //-- on cree le groupe sans car la courbe n'est pas profil spatioal, elel peut etre socpgen--// - nvGroupe=getGroup(H2dVariableType.SANS,true); + nvGroupe=getGroup(H2dVariableType.SANS,true); //nvGroupe.addEGComponent(courbe); //listeVar.put(groupe, MvProfileFillePanel.createGroupFor(H2dVariableType.SANS)); listeCourbeToAdd.add(courbe); } - - } - + } - - //-- ajout de la liste des children dans le bon groupe --// + + } + + //-- ajout de la liste des children dans le bon groupe --// + if(nvGroupe!=null) nvGroupe.addEGComponent(listeCourbeToAdd); - - //-- ajout du groupe dans la liste a supprimer --// - listeGroupeAsupprimer.add(groupe); - } + + //-- ajout du groupe dans la liste a supprimer --// + listeGroupeAsupprimer.add(groupe); } - - this.fireStructureChanged(); - //-- ensuite on vire tout les eggroup et on les remplies dans les goup --// - for(EGGroup groupe:listeGroupeAsupprimer){ + } + this.fireStructureChanged(); + //-- ensuite on vire tout les eggroup et on les remplies dans les goup --// + for(EGGroup groupe:listeGroupeAsupprimer){ + super.remove(groupe); - - } - - - - } - + + } + + + + } + @Override public EGGrapheModel duplicate(final EGGrapheDuplicator _duplicator) { final MvProfileTreeModel duplic = new MvProfileTreeModel(); @@ -792,7 +900,7 @@ //-- duplication du target --// duplic.target_=this.target_; - + return duplic; } @@ -822,21 +930,22 @@ MvProfileTreeModelPersist dataPersistante=(MvProfileTreeModelPersist) sepcPersitData; //-- remplissage du model avec les datas--// dataPersistante.fillModelWithData(this,Params); -} - - + } + + /** - * Les actions des courbes specifiques: l'ajout de variable. - */ - public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target,CtuluUI ui) { - List<EbliActionInterface> listeActions=new ArrayList<EbliActionInterface>(); - - - //-- action replay data --// + * Les actions des courbes specifiques: l'ajout de variable. + */ + public List<EbliActionInterface> getSpecificsActionsCurvesOnly(EGGraphe _target,CtuluUI ui) { + List<EbliActionInterface> listeActions=new ArrayList<EbliActionInterface>(); + + if(EbliWidget.AMELIO_LOT_VISIBLE){ + //-- action replay data --// listeActions.add(new EGActionReplayDataCourbe.CourbeOnly(this,this.getSelectedComponent().getModel(),ui)); - return listeActions; - } - + return listeActions; + } + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-20 19:33:53 UTC (rev 4385) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-20 19:35:40 UTC (rev 4386) @@ -108,8 +108,9 @@ final EfData data = source_.getData(var_, i); if (data == null) { FuLog.warning("TRP: data is null for " + var_); + + }else super.y_[i] = ptIdx_.getInterpolateValue(getVar(), data, i, source_); - } } } @@ -534,7 +535,7 @@ TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrReplayCurvesData.getInstance().constructEvolTemporelleOrigine(this, implementation); + TrReplayCurvesData.getInstance().getEvolTemporelleOrigine(this, implementation); } @@ -546,7 +547,7 @@ TrPostCommonImplementation implementation=(TrPostCommonImplementation)impl; //-- on cree une vue 2d a partir du fichier source fourni et on le centre sur le point interpol\xE9 ou non --// - TrReplayCurvesData.getInstance().constructEvolTemporelleReplayData((TrPostCourbeTreeModel)model, this, implementation); + TrReplayCurvesData.getInstance().getEvolTemporelleReplayData((TrPostCourbeTreeModel)model, this, implementation); } 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-20 19:33:53 UTC (rev 4385) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeTreeModel.java 2009-01-20 19:35:40 UTC (rev 4386) @@ -25,6 +25,7 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluCommandManager; import org.fudaa.ctulu.CtuluLibArray; +import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.CtuluUI; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.ProgressionUpdater; @@ -45,6 +46,7 @@ import org.fudaa.ebli.courbe.EGGroup; import org.fudaa.ebli.courbe.EGModel; import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.visuallibrary.EbliWidget; import org.fudaa.fudaa.commun.courbe.FudaaCourbeModel; import org.fudaa.fudaa.commun.courbe.ScopeCourbeModel; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter.Target; @@ -59,1029 +61,1152 @@ public class TrPostCourbeTreeModel extends EGGrapheTreeModel implements TrPostTimeContentListener, Target { - FudaaCommonImplementation impl_; + FudaaCommonImplementation impl_; - Set intepolPt_; + Set intepolPt_; -// private final boolean isAllTimeStep_; + // private final boolean isAllTimeStep_; - int[] objIdx_; + int[] objIdx_; - // private int[] tidx_; + // private int[] tidx_; - TrPostProjet projet_; + TrPostProjet projet_; - protected EGGroup updating_; + protected EGGroup updating_; - final Map varGroup_; + final Map varGroup_; - Set varSupported_; + Set varSupported_; - /** - * NE PAS UTILISER POUR L'INSTANT SAUVEGARDE. - */ - public TrPostCourbeTreeModel() { - // src_ = null; - varGroup_ = new HashMap(); - impl_ = null; -// isAllTimeStep_ = true; - } + /** + * NE PAS UTILISER POUR L'INSTANT SAUVEGARDE. + */ + public TrPostCourbeTreeModel() { + // src_ = null; + varGroup_ = new HashMap(); + impl_ = null; + // isAllTimeStep_ = true; + } - // les sources devront etre affectees au CourbeModel - // final TrPostSource src_; + // les sources devront etre affectees au CourbeModel + // final TrPostSource src_; - // double[] timeSteps_; + // double[] timeSteps_; - public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src, final int[] _timeIdx, - final TrPostInterpolatePoint _interpol, final H2dVariableType[] _vars, final TrPostProjet _projet) { - this(_vars, _projet); - intepolPt_.add(_interpol); - } + public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src, final int[] _timeIdx, + final TrPostInterpolatePoint _interpol, final H2dVariableType[] _vars, final TrPostProjet _projet) { + this(_vars, _projet); + intepolPt_.add(_interpol); + } - /** - * Constructeur permettant de creer un treemodel avec plusieurs point interpol\xE9s - * - * @param _impl - * @param _src - * @param _timeIdx - * @param _interpol : le tableau de points interpoles - * @param _vars - * @param _projet - * @author Adrien Hadoux - */ - public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src, final int[] _timeIdx, - final TrPostInterpolatePoint[] _interpol, final H2dVariableType[] _vars, final TrPostProjet _projet) { - this(_vars, _projet); + /** + * Constructeur permettant de creer un treemodel avec plusieurs point interpol\xE9s + * + * @param _impl + * @param _src + * @param _timeIdx + * @param _interpol : le tableau de points interpoles + * @param _vars + * @param _projet + * @author Adrien Hadoux + */ + public TrPostCourbeTreeModel(final FudaaCommonImplementation _impl, final TrPostSource _src, final int[] _timeIdx, + final TrPostInterpolatePoint[] _interpol, final H2dVariableType[] _vars, final TrPostProjet _projet) { + this(_vars, _projet); - for (int i = 0; i < _interpol.length; i++) - intepolPt_.add(_interpol[i]); - } + for (int i = 0; i < _interpol.length; i++) + intepolPt_.add(_interpol[i]); + } - /** - * @param _src - */ - public TrPostCourbeTreeModel(final H2dVariableType[] _vars, final TrPostProjet _projet) { - // src_ = _src; - varGroup_ = new HashMap(); - // tidx_ = _timeIdx; - // Arrays.sort(tidx_); - objIdx_ = FuEmptyArrays.INT0; - intepolPt_ = new HashSet(); - varSupported_ = new HashSet(Arrays.asList(_vars)); - projet_ = _projet; - impl_ = projet_.getImpl(); -// isAllTimeStep_ = true;// tidx_.length == _src.getNbTimeStep(); + /** + * @param _src + */ + public TrPostCourbeTreeModel(final H2dVariableType[] _vars, final TrPostProjet _projet) { + // src_ = _src; + varGroup_ = new HashMap(); + // tidx_ = _timeIdx; + // Arrays.sort(tidx_); + objIdx_ = FuEmptyArrays.INT0; + intepolPt_ = new HashSet(); + varSupported_ = new HashSet(Arrays.asList(_vars)); + projet_ = _projet; + impl_ = projet_.getImpl(); + // isAllTimeStep_ = true;// tidx_.length == _src.getNbTimeStep(); - } + } - public TrPostCourbeTreeModel(final int[] _objIdx, final H2dVariableType[] _vars, final TrPostProjet _projet) { - this(/* _src , _timeIdx */_vars, _projet); - objIdx_ = _objIdx; - Arrays.sort(objIdx_); - } + public TrPostCourbeTreeModel(final int[] _objIdx, final H2dVariableType[] _vars, final TrPostProjet _projet) { + this(/* _src , _timeIdx */_vars, _projet); + objIdx_ = _objIdx; + Arrays.sort(objIdx_); + } - protected void addAllCourbes(final TrPostSource _src, final ProgressionInterface _prog, - final CtuluCommandContainer _cmd) { - // buildTimeSteps(); - startUpdating(); - final List modelToUpdate = new ArrayList(); - final List courbeToMem = _cmd == null ? null : new ArrayList(); - final List groupToMem = _cmd == null ? null : new ArrayList(); - // double[] timesInSec = _src.getTime().getTimeListModel().getTimesInSec(); - for (final Iterator it = varSupported_.iterator(); it.hasNext();) { - final H2dVariableType t = (H2dVariableType) it.next(); - final EGGroup g = getGroupFor(t); - final int nb = objIdx_.length; - for (int i = 0; i < nb; i++) { - final int idx = objIdx_[i]; - final TrPostCourbeModel c = containsCourbeFor(t, g, idx); - if (c == null) { + protected void addAllCourbes(final TrPostSource _src, final ProgressionInterface _prog, + final CtuluCommandContainer _cmd) { + // buildTimeSteps(); + startUpdating(); + final List modelToUpdate = new ArrayList(); + final List courbeToMem = _cmd == null ? null : new ArrayList(); + final List groupToMem = _cmd == null ? null : new ArrayList(); + // double[] timesInSec = _src.getTime().getTimeListModel().getTimesInSec(); + for (final Iterator it = varSupported_.iterator(); it.hasNext();) { + final H2dVariableType t = (H2dVariableType) it.next(); + final EGGroup g = getGroupFor(t); + final int nb = objIdx_.length; + for (int i = 0; i < nb; i++) { + final int idx = objIdx_[i]; + final TrPostCourbeModel c = containsCourbeFor(t, g, idx); + if (c == null) { - final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, idx, g, _src); - if (courbeToMem != null) { - courbeToMem.add(courbe); - groupToMem.add(g); - } - modelToUpdate.add(courbe.getModel()); - } else if (c.isYNull()) { - modelToUpdate.add(c); - } - } - for (final Iterator iter = intepolPt_.iterator(); iter.hasNext();) { - final TrPostInterpolatePoint element = (TrPostInterpolatePoint) iter.next(); - final TrPostCourbeModel c = containsCourbeFor(t, g, element); - if (c == null) { - final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, element, g, _src); - if (courbeToMem != null) { - courbeToMem.add(courbe); - groupToMem.add(g); - } - modelToUpdate.add(courbe.getModel()); - } else if (c.isYNull()) { - modelToUpdate.add(c); - } - } - } - if (courbeToMem != null && _cmd != null) { - _cmd.addCmd(new CommandAddCourbesMulti((EGCourbeChild[]) courbeToMem - .toArray(new EGCourbeChild[courbeToMem.size()]), (EGGroup[]) groupToMem - .toArray(new EGGroup[groupToMem.size()]))); - } - updateCurves((TrPostCourbeModel[]) modelToUpdate.toArray(new TrPostCourbeModel[modelToUpdate.size()]), _prog); - reupdateGroup(); + final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, idx, g, _src); + if (courbeToMem != null) { + courbeToMem.add(courbe); + groupToMem.add(g); + } + modelToUpdate.add(courbe.getModel()); + } else if (c.isYNull()) { + modelToUpdate.add(c); + } + } + for (final Iterator iter = intepolPt_.iterator(); iter.hasNext();) { + final TrPostInterpolatePoint element = (TrPostInterpolatePoint) iter.next(); + final TrPostCourbeModel c = containsCourbeFor(t, g, element); + if (c == null) { + final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, element, g, _src); + if (courbeToMem != null) { + courbeToMem.add(courbe); + groupToMem.add(g); + } + modelToUpdate.add(courbe.getModel()); + } else if (c.isYNull()) { + modelToUpdate.add(c); + } + } + } + if (courbeToMem != null && _cmd != null) { + _cmd.addCmd(new CommandAddCourbesMulti((EGCourbeChild[]) courbeToMem + .toArray(new EGCourbeChild[courbeToMem.size()]), (EGGroup[]) groupToMem + .toArray(new EGGroup[groupToMem.size()]))); + } + updateCurves((TrPostCourbeModel[]) modelToUpdate.toArray(new TrPostCourbeModel[modelToUpdate.size()]), _prog); + reupdateGroup(); - } + } - /** - * Refonte de la methode addpoints pour gerer les fusions de graphes. fusionne les variables des 2 graphes model afin - * de recuperer toutes les variabels. - * - * @author Adrien Hadoux - * @param _idxToAdd - * @param _cmd - * @param _prog - * @param variablesGrapheMerge - */ - public void addPoints(final TrPostSource _src, final int[] _idxToAdd, final CtuluCommandContainer _cmd, - final ProgressionInterface _prog, final Set variablesGrapheMerge) { - // pour le undo - final int[] old = CtuluLibArray.copy(objIdx_); - final TIntHashSet hasset = new TIntHashSet(objIdx_); - hasset.addAll(_idxToAdd); - objIdx_ = hasset.toArray(); - Arrays.sort(objIdx_); - Arrays.sort(_idxToAdd); - // buildTimeSteps(); - startUpdating(); - final List modelToUpdate = new ArrayList(); - final List courbeToMem = _cmd == null ? null : new ArrayList(); - final List groupToMem = _cmd == null ? null : new ArrayList(); + /** + * Refonte de la methode addpoints pour gerer les fusions de graphes. fusionne les variables des 2 graphes model afin + * de recuperer toutes les variabels. + * + * @author Adrien Hadoux + * @param _idxToAdd + * @param _cmd + * @param _prog + * @param variablesGrapheMerge + */ + public void addPoints(final TrPostSource _src, final int[] _idxToAdd, final CtuluCommandContainer _cmd, + final ProgressionInterface _prog, final Set variablesGrapheMerge) { + // pour le undo + final int[] old = CtuluLibArray.copy(objIdx_); + final TIntHashSet hasset = new TIntHashSet(objIdx_); + hasset.addAll(_idxToAdd); + objIdx_ = hasset.toArray(); + Arrays.sort(objIdx_); + Arrays.sort(_idxToAdd); + // buildTimeSteps(); + startUpdating(); + final List modelToUpdate = new ArrayList(); + final List courbeToMem = _cmd == null ? null : new ArrayList(); + final List groupToMem = _cmd == null ? null : new ArrayList(); - // -- completer les variables du graphe avec celles du graphe merg\xE9 --// - if (variablesGrapheMerge != null) { - for (final Iterator it = variablesGrapheMerge.iterator(); it.hasNext();) { - final H2dVariableType t = (H2dVariableType) it.next(); - varSupported_.add(t); - } - } + // -- completer les variables du graphe avec celles du graphe merg\xE9 --// + if (variablesGrapheMerge != null) { + for (final Iterator it = variablesGrapheMerge.iterator(); it.hasNext();) { + final H2dVariableType t = (H2dVariableType) it.next(); + varSupported_.add(t); + } + } - for (final Iterator it = varSupported_.iterator(); it.hasNext();) { - final H2dVariableType t = (H2dVariableType) it.next(); - final EGGroup g = getGroupFor(t); - final int nb = _idxToAdd.length; - for (int i = 0; i < nb; i++) { - final int idx = _idxToAdd[i]; - final TrPostCourbeModel c = containsCourbeFor(t, g, idx); - if (c == null) { - final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, idx, g, _src); - if (courbeToMem != null) { - courbeToMem.add(courbe); - groupToMem.add(g); - } - modelToUpdate.add(courbe.getModel()); - } else if (c.isYNull()) { - modelToUpdate.add(c); - } - } - } - if (courbeToMem != null && _cmd != null) { - _cmd.addCmd(new CommandAddCourbesMulti((EGCourbeChild[]) courbeToMem - .toArray(new EGCourbeChild[courbeToMem.size()]), (EGGroup[]) groupToMem - .toArray(new EGGroup[groupToMem.size()])) { + for (final Iterator it = varSupported_.iterator(); it.hasNext();) { + final H2dVariableType t = (H2dVariableType) it.next(); + final EGGroup g = getGroupFor(t); + final int nb = _idxToAdd.length; + for (int i = 0; i < nb; i++) { + final int idx = _idxToAdd[i]; + final TrPostCourbeModel c = containsCourbeFor(t, g, idx); + if (c == null) { + final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, idx, g, _src); + if (courbeToMem != null) { + courbeToMem.add(courbe); + groupToMem.add(g); + } + modelToUpdate.add(courbe.getModel()); + } else if (c.isYNull()) { + modelToUpdate.add(c); + } + } + } + if (courbeToMem != null && _cmd != null) { + _cmd.addCmd(new CommandAddCourbesMulti((EGCourbeChild[]) courbeToMem + .toArray(new EGCourbeChild[courbeToMem.size()]), (EGGroup[]) groupToMem + .toArray(new EGGroup[groupToMem.size()])) { - @Override - public void redo() { - super.redo(); - final TIntHashSet hassetRedo = new TIntHashSet(objIdx_); - hassetRedo.addAll(_idxToAdd); - objIdx_ = hassetRedo.toArray(); - Arrays.sort(objIdx_); - reupdateGroup(); - } + @Override + public void redo() { + super.redo(); + final TIntHashSet hassetRedo = new TIntHashSet(objIdx_); + hassetRedo.addAll(_idxToAdd); + objIdx_ = hassetRedo.toArray(); + Arrays.sort(objIdx_); + reupdateGroup(); + } - @Override - public void undo() { - super.undo(); - objIdx_ = old; - reupdateGroup(); - } - }); - } - updateCurves((TrPostCourbeModel[]) modelToUpdate.toArray(new TrPostCourbeModel[modelToUpdate.size()]), _prog); - reupdateGroup(); + @Override + public void undo() { + super.undo(); + objIdx_ = old; + reupdateGroup(); + } + }); + } + updateCurves((TrPostCourbeModel[]) modelToUpdate.toArray(new TrPostCourbeModel[modelToUpdate.size()]), _prog); + reupdateGroup(); - } + } - /** - * Refonte de la methode addpoints pour gerer les fusions de graphes. fusionne les variables des 2 graphes model afin - * de recuperer toutes les variabels. - * - * @author Adrien Hadoux - */ - public void addPoints(final TrPostSource _src, final TrPostInterpolatePoint _idxToAdd, - final CtuluCommandContainer _cmd, final ProgressionInterface _prog, final Set variablesGrapheMerge) { - startUpdating(); - // pour le undo - final List modelToUpdate = new ArrayList(); - final List courbeToMem = _cmd == null ? null : new ArrayList(); - final List groupToMem = _cmd == null ? null : new ArrayList(); - this.intepolPt_.add(_idxToAdd); - // -- completer les variables du graphe avec celles du graphe merg\xE9 --// - if (variablesGrapheMerge != null) { - for (final Iterator it = variablesGrapheMerge.iterator(); it.hasNext();) { - final H2dVariableType t = (H2dVariableType) it.next(); - varSupported_.add(t); - } - } - for (final Iterator it = varSupported_.iterator(); it.hasNext();) { - final H2dVariableType t = (H2dVariableType) it.next(); - final EGGroup g = getGroupFor(t); - final TrPostCourbeModel c = containsCourbeFor(t, g, _idxToAdd); - if (c == null) { - final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, _idxToAdd, g, _src); - if (courbeToMem != null) { - courbeToMem.add(courbe); - groupToMem.add(g); - } - modelToUpdate.add(courbe.getModel()); - } else if (c.isYNull()) { - modelToUpdate.add(c); - } - } - if (courbeToMem != null && _cmd != null) { - _cmd.addCmd(new CommandAddCourbesMulti((EGCourbeChild[]) courbeToMem - .toArray(new EGCourbeChild[courbeToMem.size()]), (EGGroup[]) groupToMem - .toArray(new EGGroup[groupToMem.size()])) { + /** + * Rejoue les donn\xE9es du point avec les nouvelles infos. + * Cree syst\xE9matiquement une nouvelle courbe avec le mod\xE8le qui convient. + * Dans le cas ou ecraser est \xE0 true, on supprime le modele pass\xE9 en paramtere. + * Version r\xE9serv\xE9s aux points r\xE9els + * @param _model + * @param _src + * @param _idxToAdd + * @param _cmd + * @param _prog + * @param newVariable + * @param ecraser + */ + public void replayPoints(TrPostCourbeModel _model,final TrPostSource _src, final int _idxToAdd, final CtuluCommandContainer _cmd, + final ProgressionInterface _prog, H2dVariableType newVariable, boolean ecraser) { - @Override - public void redo() { - super.redo(); - intepolPt_.add(_idxToAdd); - reupdateGroup(); - } + //-- ajout de la variable --// + varSupported_.add(newVariable); + final EGGroup g = getGroupFor(newVariable); + final TrPostCourbeModel c = containsCourbeFor(newVariable, g, _idxToAdd); + EGCourbeChild courbe = null; + if (c == null) { + courbe = TrPostCourbeModel.buildCourbeModel(newVariable, _idxToAdd, g, _src); + } - @Override - public void undo() { - super.undo(); - intepolPt_.remove(_idxToAdd); - reupdateGroup(); - } - }); - } - updateCurves((TrPostCourbeModel[]) modelToUpdate.toArray(new TrPostCourbeModel[modelToUpdate.size()]), _prog); - reupdateGroup(); - } + - /** - * Ajoute une variable par rapport a une courbe evolution temporelle selectionnee. - * La variable a ete choisie ainsi que le fichier source. - * @param modelCourbe - * @param _src - * @param _var - * @param _prog - * @param _cmd - */ - protected void addVariables(TrPostCourbeModel modelCourbe,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; - final double[] timesInSec = _src.getTime().getTimeListModel().getTimesInSec(); - final TrPostCourbeModel[] model = new TrPostCourbeModel[_var.size()];//_var.size() * (nbPt + intepolPt_.size())]; - int idx = 0; - final List courbeToMem = _cmd == null ? null : new ArrayList(); - final List groupToMem = _cmd == null ? null : new ArrayList(); - for (int i = 0; i < _var.size(); i++) { - final H2dVariableType var = (H2dVariableType) _var.get(i); - final EGGroup g = getGroupFor(var); - // for (int idxPt = 0; idxPt < nbPt; idxPt++) { - - //-- cas reel --// - if(modelCourbe instanceof TrPostCourbeModel.Node){ - final EGCourbeChild c = TrPostCourbeModel.buildCourbeModel(var, ((Integer)modelCourbe.getSelectionPoint()).intValue(), g, _src); - courbeToMem.add(c); - groupToMem.add(g); - model[idx++] = (TrPostCourbeModel) c.getModel(); - } - else{ - //for (final Iterator iter = intepolPt_.iterator(); iter.hasNext();) { - //-- cas point interpol\xE9 --// - - final TrPostInterpolatePoint element = (TrPostInterpolatePoint)modelCourbe.getSelectionPoint(); - final EGCourbeChild c = TrPostCourbeModel.buildCourbeModel(var, element, g, _src); - courbeToMem.add(c); - groupToMem.add(g); - model[idx++] = (TrPostCourbeModel) c.getModel(); - } - } - updateCurves(model, _prog); - varSupported_.addAll(_var); - reupdateCourbes(); - if (courbeToMem != null && _cmd != null) { - final CtuluCommandComposite cmp = new CtuluCommandComposite() { + TrPostCourbeModel[] listeUpdate=new TrPostCourbeModel[1]; + listeUpdate[0]=((TrPostCourbeModel)courbe.getModel()); + updateCurves(listeUpdate, _prog); + + //-- on reajuste les y --// + CtuluRange range=new CtuluRange(courbe.getModel().getYMin(),courbe.getModel().getYMax()); + g.ajusteY(range); + // reupdateGroup(); + + if(ecraser){ + //-- il faut supprimer le modele initial --// + this.removeModele(_model,_cmd); - @Override - protected void actionToDoAfterUndoOrRedo() { - reupdateGroup(); - }; + } + + fireStructureChanged(); + fireAxeAspectChanged(courbe.getAxeY()); + } - @Override - protected boolean isActionToDoAfterUndoOrRedo() { - return true; - }; - }; - cmp.addCmd(new CommandAddCourbesMulti((EGCourbeChild[]) courbeToMem - .toArray(new EGCourbeChild[courbeToMem.size()]), (EGGroup[]) groupToMem - .toArray(new EGGroup[groupToMem.size()]))); - cmp.addCmd(new CtuluCommand() { + /** + * Rejoue les donn\xE9es du point avec les nouvelles infos. + * Cree syst\xE9matiquement une nouvelle courbe avec le mod\xE8le qui convient. + * Dans le cas ou ecraser est \xE0 true, on supprime le modele pass\xE9 en paramtere. + * Version r\xE9serv\xE9s aux points r\xE9els + * @param _model + * @param _src + * @param _idxToAdd + * @param _cmd + * @param _prog + * @param newVariable + * @param ecraser + */ + public void replayPoints(TrPostCourbeModel _model,final TrPostSource _src, final TrPostInterpolatePoint _idxToAdd, final CtuluCommandContainer _cmd, + final ProgressionInterface _prog, H2dVariableType newVariable, boolean ecraser) { - public void redo() { - varSupported_.addAll(_var); - } + //-- ajout de la variable --// + varSupported_.add(newVariable); + final EGGroup g = getGroupFor(newVariable); + final TrPostCourbeModel c = containsCourbeFor(newVariable, g, _idxToAdd); + EGCourbeChild courbe = null; + if (c == null) { + courbe = TrPostCourbeModel.buildCourbeModel(newVariable, _idxToAdd, g, _src); + } - public void undo() { - varSupported_.removeAll(_var); - } - }); + - _cmd.addCmd(cmp); - } - - - //-- on ajoute de le groupe sans variable si il existait avant les modif: --// -// if(groupeSansVariables!=null){ -// add(groupeSansVariables); -// fireStructureChanged(); -// } + TrPostCourbeModel[] listeUpdate=new TrPostCourbeModel[1]; + listeUpdate[0]=((TrPostCourbeModel)courbe.getModel()); + updateCurves(listeUpdate, _prog); + // reupdateGroup(); + + if(ecraser){ + //-- il faut supprimer le modele initial --// + this.removeModele(_model,_cmd); - } + } + fireStructureChanged(); + fireAxeAspectChanged(courbe.getAxeY()); + + + } - - - - private void buildUpdating() { - if (updating_ == null) { - updating_ = new EGGroup(); - updating_.setTitle(TrResource.getS("Mise \xE0 jour")); - } - } + /** + * Methode qui supprime la courbe pour son modele du profil spatial. + * Supprime \xE9galement le groupe de variable si ce dernier ne contient pas d'autres courbes. + * @param model + * @param mng + */ + public void removeModele(TrPostCourbeModel model,CtuluCommandContainer mng){ - @Override - public boolean canDeleteCourbes() { - return true; - } + //-- on recupere le groupe du modele --// + EGGroup group = (EGGroup) varGroup_.get(model.var_); + EGCourbeChild[] liste=new EGCourbeChild[1]; + boolean trouve=false; + for (int i = group.getChildCount() - 1;!trouve && i >= 0; i--) { + final TrPostCourbeModel res = (TrPostCourbeModel) group.getCourbeAt(i).getModel(); + if (res==model) { + liste[0]=group.getCourbeAt(i); + trouve=true; + } + } + if(trouve) + removeCurves(liste,mng ); - protected TrPostCourbeModel containsCourbeFor(final H2dVariableType _t, final EGGroup _g, final int _idx) { - for (int i = _g.getChildCount() - 1; i >= 0; i--) { - final TrPostCourbeModel res = (TrPostCourbeModel) _g.getCourbeAt(i).getModel(); - if (_t == res.getVar() && res.isCourbeForObject(_idx)) { return res; } - } - return null; - } + //-- test si le groupe ne contient rien, on le degage --// + if(group.getEGChilds()==null || group.getEGChilds().length==0){ + this.remove(group); + this.varGroup_.remove(model.var_); + } + } - protected TrPostCourbeModel containsCourbeFor(final H2dVariableType _t, final EGGroup _g, - final TrPostInterpolatePoint _idx) { - for (int i = _g.getChildCount() - 1; i >= 0; i--) { - final TrPostCourbeModel res = (TrPostCourbeModel) _g.getCourbeAt(i).getModel(); - if (_t == res.getVar() && res.isCourbeForInterpolation(_idx)) { return res; } - } - return null; - } + /** + * Refonte de la methode addpoints pour gerer les fusions de graphes. fusionne les variables des 2 graphes model afin + * de recuperer toutes les variabels. + * + * @author Adrien Hadoux + */ + public void addPoints(final TrPostSource _src, final TrPostInterpolatePoint _idxToAdd, + final CtuluCommandContainer _cmd, final ProgressionInterface _prog, final Set variablesGrapheMerge) { + startUpdating(); + // pour le undo + final List modelToUpdate = new ArrayList(); + final List courbeToMem = _cmd == null ? null : new ArrayList(); + final List groupToMem = _cmd == null ? null : new ArrayList(); + this.intepolPt_.add(_idxToAdd); - /** - * Il n'y a rien a faire. - */ - public void dataAdded(final boolean _isFleche) {} + // -- completer les variables du graphe avec celles du graphe merg\xE9 --// + if (variablesGrapheMerge != null) { + for (final Iterator it = variablesGrapheMerge.iterator(); it.hasNext();) { + final H2dVariableType t = (H2dVariableType) it.next(); + varSupported_.add(t); + } + } - public void dataChanged(final H2dVariableType _old, final H2dVariableType _new, final boolean _contentChanged, - final boolean _isFleche, final Set _varsUsing, final ProgressionInterface _prog) { - if (_isFleche) { return; } - varSupported_.remove(_old); - varSupported_.add(_new); - // si le contenu n'est pas modifie, il faut juste changer les pointeurs des variables - if (_contentChanged || _old == _new) { - final EGCourbe[] cs = getCourbes(); - if (cs == null) { return; } - // rebuild a true si on doit reconstruire le tout - final List modelToUpdate = new ArrayList(); - for (int i = cs.length - 1; i >= 0; i--) { - final TrPostCourbeModel model = (TrPostCourbeModel) cs[i].getModel(); - if (model.getVar() == _old) { - model.setY(null); - model.setVar(_new); - modelToUpdate.add(model); - } else if (_varsUsing != null && _varsUsing.contains(model.getVar())) { - model.setY(null); - modelToUpdate.add(model); - startUpdating(); - } + for (final Iterator it = varSupported_.iterator(); it.hasNext();) { + final H2dVariableType t = (H2dVariableType) it.next(); + final EGGroup g = getGroupFor(t); + final TrPostCourbeModel c = containsCourbeFor(t, g, _idxToAdd); + if (c == null) { + final EGCourbeChild courbe = TrPostCourbeModel.buildCourbeModel(t, _idxToAdd, g, _src); + if (courbeToMem != null) { + courbeToMem.add(courbe); + groupToMem.add(g); + } + modelToUpdate.add(courbe.getModel()); + } else if (c.isYNull()) { + modelToUpdate.add(c); + } + } + if (courbeToMem != null && _cmd != null) { + _cmd.addCmd(new CommandAddCourbesMulti((EGCourbeChild[]) courbeToMem + .toArray(new EGCourbeChild[courbeToMem.size()]), (EGGroup[]) groupToMem + .toArray(new EGGroup[groupToMem.size()])) { - } - // mise a jour des modeles dans un thread s\xE9par\xE9. - if (modelToUpdate.size() > 0) { + @Override + public void redo() { + super.redo(); + intepolPt_.add(_idxToAdd); + reupdateGroup(); + } - updateCurves((TrPostCourbeModel[]) modelToUpdate.toArray(new TrPostCourbeModel[modelToUpdate.size()]), _prog); - reupdateGroup(); - } - } else { - final ArrayList crbUsingOld = new ArrayList(); - getCourbeFor(_old, crbUsingOld); - for (final Iterator iter = crbUsingOld.iterator(); iter.hasNext();) { - final TrPostCourbeModel model = (TrPostCourbeModel) ((EGCourbe) iter.next()).getModel(); - // on change le pointeur - model.setVar(_new); - } - } - } + @Override + public void undo() { + super.undo(); + intepolPt_.remove(_idxToAdd); + reupdateGroup(); + } + }); + } + updateCurves((TrPostCourbeModel[]) modelToUpdate.toArray(new TrPostCourbeModel[modelToUpdate.size()]), _prog); + reupdateGroup(); - // protected void buildTimeSteps() { - // if (timeSteps_ == null) { - // timeSteps_ = new double[this.src_.getNbTimeStep()/* - // * tidx_.length - // */]; - // // mise a jour des pas de temps - // for (int i = this.src_.getNbTimeStep() - 1; i >= 0; i--) { - // // timeSteps_[i] = src_.getTimeStep(tidx_[i]); - // timeSteps_[i] = src_.getTimeStep(i); - // } - // } - // } + } - public void dataRemoved(final H2dVariableType[] _vars, final boolean _isFleche) { - if (_isFleche || _vars == null) { return; } - varSupported_.removeAll(Arrays.asList(_vars)); - final List courbeToRemove = new ArrayList(); - for (int i = _vars.length - 1; i >= 0; i--) { - getCourbeFor(_vars[i], courbeToRemove); - } - removeCurves((EGCourbeChild[]) courbeToRemove.toArray(new EGCourbeChild[courbeToRemove.size()]), null); + /** + * Ajoute une variable par rapport a une courbe evolution temporelle selectionnee. + * La variable a ete choisie ainsi que le fichier source. + * @param modelCourbe + * @param _src + * @param _var + * @param _prog + * @param _cmd + */ + protected void addVariables(TrPostCourbeModel modelCourbe,final TrPostSource _src, final List _var, final ProgressionInterface _prog, + final CtuluCommandContainer _cmd) { + // buildTimeSteps(); - } - @Override - protected EGCourbeChild duplicateCourbe(final EGCourbeChild _c) { - return null; - } + //-- 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); - /** - * OVERIDE. methode qui demande a l user de choisir sa courbe puis genere une copie avec la source en cours. - * - * @param _child - * @return - */ - @Override - protected EGCourbeChild duplicateWithChooseSrc(final EGCourbeChild _child) { + startUpdating(); - // -- mise en place du chooser des projets sources disponibles --// + if(varSupported_==null) + varSupported_= new HashSet(); - // -- recuperation du source voulu --// - // -- recuperation de la liste des src sous forme de liste --// - final String[] values = formattageDonnees(); - // -- ouverture du chooser --// - final BuDialogChoice chooser = new BuDialogChoice(projet_.impl_.getApp(), projet_.impl_.getInformationsSoftware(), - TrResource.getS("Cr\xE9ation d'un calque"), TrResource.getS("S\xE9lectionnez le jeux de donn\xE9es "), values); + // fusion graphes + _var.removeAll(varSupported_); + //final int nbPt = objIdx_.length; + final double[] timesInSec = _src.getTime().getTimeListModel().getTimesInSec(); + final TrPostCourbeModel[] model = new TrPostCourbeModel[_var.size()];//_var.size() * (nbPt + intepolPt_.size())]; + int idx = 0; + final List courbeToMem = _cmd == null ? null : new ArrayList(); + final List groupToMem = _cmd == null ? null : new ArrayList(); + for (int i = 0; i < _var.size(); i++) { + final H2dVariableType var = (H2dVariableType) _var.get(i); + final EGGroup g = getGroupFor(var); + // for (int idxPt = 0; idxPt < nbPt; idxPt++) { - final int response = chooser.activate(); + //-- cas reel --// + if(modelCourbe instanceof TrPostCourbeModel.Node){ + final EGCourbeChild c = TrPostCourbeModel.buildCourbeModel(var, ((Integer)modelCourbe.getSelectionPoint()).intValue(), g, _src); + courbeToMem.add(c); + groupToMem.add(g); + model[idx++] = (TrPostCourbeModel) c.getModel(); + } + else{ + //for (final Iterator iter = intepolPt_.iterator(); iter.hasNext();) { + //-- cas point interpol\xE9 --// - if (response == 0) { + final TrPostInterpolatePoint element = (TrPostInterpolatePoint)modelCourbe.getSelectionPoint(); + final EGCourbeChild c = TrPostCourbeModel.buildCourbeModel(var, element, g, _src); + courbeToMem.add(c); + groupToMem.add(g); + model[idx++] = (TrPostCourbeModel) c.getModel(); + } + } + updateCurves(model, _prog); + varSupported_.addAll(_var); + reupdateCourbes(); + if (courbeToMem != null && _cmd != null) { + final CtuluCommandComposite cmp = new CtuluCommandComposite() { - final int indiceSOURCESelect = chooser.getSelectedIndex(); + @Override + protected void actionToDoAfterUndoOrRedo() { + reupdateGroup(); + }; - final TrPostSource srcChoisie = projet_.getSource(indiceSOURCESelect); + @Override + protected boolean isActionToDoAfterUndoOrRedo() { + return true; + }; + }; + cmp.addCmd(new CommandAddCourbesMulti((EGCourbeChild[]) courbeToMem + .toArray(new EGCourbeChild[courbeToMem.size()]), (EGGroup[]) groupToMem + .toArray(new EGGroup[groupToMem.size()]))); + cmp.addCmd(new CtuluCommand() { - EGCourbeChild newCurve = null; + public void redo() { + varSupported_.addAll(_var); + } - // -- recuperation du point interpol\xE9 ou non selon le cas --// - // if(_child.getModel() instanceof TrPostCourbeModel.Node){ + public void undo() { + varSupported_.removeAll(_var); + } - // -- CAS COURBE REELLE --// - final TrPostCourbeModel modelBase = (TrPostCourbeModel) _child.getModel(); - final H2dVariableType var = modelBase.getVar(); + }); - // -- verification si le point du model choisi est reel ou interpol\xE9 - // dans la nouvelle source --// - // if (srcChoisie.getGrid().contientPoint(modelBase.getPtX(), modelBase.getPtY())) { - // - // // -- CREATION DE LA COURBE REELE DEPUIS COURBE REELLE --// - // newCurve = TrPostCourbeModel.buildCourbeModel(var, ((TrPostCourbeModel.Node) modelBase).ptIdx_, _child - // .getParentGroup(), srcChoisie); - // } else { - // -- on recupere le point le plus proche pour interpoler --// - final GrPoint pointAInterpole = new GrPoint(modelBase.getPtX(), modelBase.getPtY(), 0); - final int newPtIdx = TrIsoLayerDefault.sondeSelection(pointAInterpole, srcChoisie.getGrid()); + _cmd.addCmd(cmp); + } - if (newPtIdx != -1) { - final TrPostInterpolatePoint interpolatePoint = new TrPostInterpolatePoint(newPtIdx, pointAInterpole.x_, - pointAInterpole.y_, new GISPrecision()); + //-- on ajoute de le groupe sans variable si il existait avant les modif: --// + // if(groupeSansVariables!=null){ + // add(groupeSansVariables); + // fireStructureChanged(); + // } - // -- CREATION DE LA COURBE INTERPOLEE DEPUIS COURBE REELLE --// - newCurve = TrPostCourbeModel.buildCourbeModel(modelBase.getVar(), interpolatePoint, _child.getParentGroup(), - srcChoisie); - // } - } + } - // -- recuperation des y de son duplicata --// - ((TrPostCourbeModel) newCurve.getModel()).setY(new double[modelBase.getY().length]); - final double[] ds = modelBase.getTime(); - for (int i = 0; i < ds.length; i++) { - ((TrPostCourbeModel) newCurve.getModel()).updateY(); - } - newCurve.setTitle(newCurve.getTitle() + " " - + projet_.formatName(projet_.getSource(indiceSOURCESelect).getTitle())); - return newCurve; - } - return null; - } + private void buildUpdating() { + if (updating_ == null) { + updating_ = new EGGroup(); + updating_.setTitle(TrResource.getS("Mise \xE0 jour")); + } + } - String[] formattageDonnees() { + @Override + public boolean canDeleteCourbes() { + return true; + } - final String[] listeSimul = new String[projet_.listeSrc_.size()]; - int cpt = 0; - for (final Iterator<TrPostSource> it = projet_.listeSrc_.iterator(); it.hasNext();) { + protected TrPostCourbeModel containsCourbeFor(final H2dVariableType _t, final EGGroup _g, final int _idx) { + for (int i = _g.getChildCount() - 1; i >= 0; i--) { + final TrPostCourbeModel res = (TrPostCourbeModel) _g.getCourbeAt(i).getModel(); + if (_t == res.getVar() && res.isCourbeForObject(_idx)) { return res; } + } + return null; + } - final TrPostSource src = it.next(); + protected TrPostCourbeModel containsCourbeFor(final H2dVariableType _t, final EGGroup _g, + final TrPostInterpolatePoint _idx) { + for (int i = _g.getChildCount() - 1; i >= 0; i--) { + final TrPostCourbeModel res = (TrPostCourbeModel) _g.getCourbeAt(i).getModel(); + if (_t == res.getVar() && res.isCourbeForInterpolation(_idx)) { return res; } + } + return null; + } - // --ajout dans la liste des titres --// - listeSimul[cpt++] = projet_.formatInfoSource(src); - } + /** + * Il n'y a rien a faire. + */ + public void dataAdded(final boolean _isFleche) {} - return listeSimul; - } + public void dataChanged(final H2dVariableType _old, final H2dVariableType _new, final boolean _contentChanged, + final boolean _isFleche, final Set _varsUsing, final ProgressionInterface _prog) { + if (_isFleche) { return; } + varSupported_.remove(_old); + varSupported_.add(_new); + // si le contenu n'est pas modifie, il faut juste changer les pointeurs des variables + if (_contentChanged || _old == _new) { + final EGCourbe[] cs = getCourbes(); + if (cs == null) { return; } + // rebuild a true si on doit reconstruire le tout + final List modelToUpdate = new ArrayList(); + for (int i = cs.length - 1; i >= 0; i--) { + final TrPostCourbeModel model = (TrPostCourbeModel) cs[i].getModel(); + if (model.getVar() == _old) { + model.setY(null); + model.setVar(_new); + modelToUpdate.add(model); + } else if (_varsUsing != null && _varsUsing.contains(model.getVar())) { + model.setY(null); + modelToUpdate.add(model); + startUpdating(); + } - /** - * Determine les courbes qui correspondent a la variable et les stocke dans la liste _l. - * - * @param _var - * @param _l contient toutes les courbes qui appartiennent a la variable - */ - void getCourbeFor(final H2dVariableType _var, final List _l) { - final EGGroup g = getGroupFor(_var); - for (int i = g.getChildCount() - 1; i >= 0; i--) { - if (((TrPostCourbeModel) g.getCourbeAt(i).getModel()).getVar() == _var) { - _l.add(g.getCourbeAt(i)); - } - } - } + } + // mise a jour des modeles dans un thread s\xE9par\xE9. + if (modelToUpdate.size() > 0) { - /** - * Recherche ou cree un groupe correspondant a la variable pour eviter les doublons. - * - * @param _t - * @return - */ - public EGGroup getGroupFor(final H2dVariableType _t) { - i... [truncated message content] |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4400]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <de...@us...> - 2009-01-24 22:16:10
|
Revision: 4400 http://fudaa.svn.sourceforge.net/fudaa/?rev=4400&view=rev Author: deniger Date: 2009-01-24 22:16:05 +0000 (Sat, 24 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireComputeAndDisplayActivity.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-01-24 21:50:40 UTC (rev 4399) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2009-01-24 22:16:05 UTC (rev 4400) @@ -61,7 +61,6 @@ import com.memoire.bu.BuValueValidator; import com.memoire.bu.BuWizardDialog; import com.memoire.bu.BuWizardTask; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.List; /** * Wizard qui se charge d'importer des courbes au format scope dans le post. Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2009-01-24 21:50:40 UTC (rev 4399) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutFille.java 2009-01-24 22:16:05 UTC (rev 4400) @@ -46,7 +46,6 @@ import org.fudaa.ebli.visuallibrary.calque.EbliWidgetCreatorVueCalque; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorArrowEditor; import org.fudaa.ebli.visuallibrary.creator.EbliWidgetCreatorTextEditor; -import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetControllerGraphe; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter; import org.fudaa.fudaa.commun.courbe.FudaaCourbeImporter.Target; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireComputeAndDisplayActivity.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireComputeAndDisplayActivity.java 2009-01-24 21:50:40 UTC (rev 4399) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireComputeAndDisplayActivity.java 2009-01-24 22:16:05 UTC (rev 4400) @@ -1,8 +1,6 @@ package org.fudaa.fudaa.tr.post; -import java.awt.Frame; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -14,7 +12,6 @@ import org.fudaa.ctulu.CtuluVariable; import org.fudaa.ctulu.CtuluVariableDefault; import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.ctulu.gis.GISAttribute; import org.fudaa.ctulu.gis.GISAttributeInterface; import org.fudaa.ctulu.gis.GISDataModel; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; @@ -110,17 +107,15 @@ FSigLayerGroup traj_; - - TrPostTrajectoireLineLayer calqueAecraser_=null; - + TrPostTrajectoireLineLayer calqueAecraser_ ; - public TrPostTrajectoireComputeAndDisplayActivity(final TrPostVisuPanel calque,TrPostTrajectoireLineLayer c) { - this(calque); - calqueAecraser_=c; + public TrPostTrajectoireComputeAndDisplayActivity(final TrPostVisuPanel calque, TrPostTrajectoireLineLayer c) { + this.pn_ = calque; + calqueAecraser_ = c; } - + public TrPostTrajectoireComputeAndDisplayActivity(final TrPostVisuPanel calque) { - this.pn_ = calque; + this(calque, null); } /** @@ -134,8 +129,8 @@ * @param _prog l'interface de progression, peut etre null * @return */ - public String computeLigneCourant(TrPostVisuPanel vue2d,final EfTrajectoireParameters _data, final CtuluAnalyze _analyse, - final ProgressionInterface _prog) { + public String computeLigneCourant(TrPostVisuPanel vue2d, final EfTrajectoireParameters _data, + final CtuluAnalyze _analyse, final ProgressionInterface _prog) { stop_ = false; // on recupere les lignes de courant activity_ = new EfTrajectoireActivity(pn_.getSource().getInterpolator(), new MvProfileCoteTester(), pn_.getSource() @@ -152,30 +147,30 @@ final List<GISAttributeInterface> attDansOrdreIns = fillCorrespondantAttributeVariable(_data, gr, varAtttributes); GISDataModel model = TrPostTrajectoireGisDataModel.build(computeLigneCourant, attDansOrdreIns, varAtttributes, _analyse); - if (model == null) return null; + if (model == null || _analyse.containsFatalError()) return null; final FSigLayerGroup dest = getDestGroup(_data.isTrajectoire()); final GISZoneCollectionLigneBrisee lb = new GISZoneCollectionLigneBrisee(); lb.setAttributes(attDansOrdreIns.toArray(new GISAttributeInterface[attDansOrdreIns.size()]), null); lb.addAll(model, null, false); - String titreCalque=""; - if(calqueAecraser_==null){ - CtuluDialogPanel pn = new CtuluDialogPanel(false); - pn.setLayout(new BuGridLayout(2)); - pn.addLabel(TrLib.getString("Indiquer le nom du calque \xE0 cr\xE9er")); - JTextField tf = pn.addStringText(); - tf.setColumns(10); - pn.afficheModale(CtuluLibSwing.getActiveWindow(), getCalqueName(_data.isTrajectoire()), CtuluDialog.OK_OPTION); - titreCalque=tf.getText(); - }else{ - titreCalque=calqueAecraser_.getTitle(); - //-- on detruit le calque apres rejoue de donn\xE9es --// - calqueAecraser_.setDestructible(true); - this.pn_.detruireCalque(calqueAecraser_); - + String titreCalque = ""; + if (calqueAecraser_ == null) { + CtuluDialogPanel pn = new CtuluDialogPanel(false); + pn.setLayout(new BuGridLayout(2)); + pn.addLabel(TrLib.getString("Indiquer le nom du calque \xE0 cr\xE9er")); + JTextField tf = pn.addStringText(); + tf.setColumns(10); + pn.afficheModale(CtuluLibSwing.getActiveWindow(), getCalqueName(_data.isTrajectoire()), CtuluDialog.OK_OPTION); + titreCalque = tf.getText(); + } else { + titreCalque = calqueAecraser_.getTitle(); + // -- on detruit le calque apres rejoue de donn\xE9es --// + calqueAecraser_.setDestructible(true); + this.pn_.detruireCalque(calqueAecraser_); + } - final ZCalqueLigneBrisee la = createLayer(vue2d,_data, dest, lb, titreCalque, findAttributeForVariable(varAtttributes, - MARK)); + final ZCalqueLigneBrisee la = createLayer(vue2d, _data, dest, lb, titreCalque, findAttributeForVariable( + varAtttributes, MARK)); dest.enPremier(la); return TrResource.TR.getString("Calque {0} cr\xE9\xE9", la.getTitle()); @@ -189,9 +184,9 @@ return null; } - private ZCalqueLigneBrisee createLayer(TrPostVisuPanel vue2d,final EfTrajectoireParameters _data, final FSigLayerGroup dest, - final GISZoneCollectionLigneBrisee lb, String _title, GISAttributeInterface _mark) { - final ZCalqueLigneBrisee la = new TrPostTrajectoireLineLayer(vue2d,_data, new ZModeleLigneBriseeDefault(lb), _mark); + private ZCalqueLigneBrisee createLayer(TrPostVisuPanel vue2d, final EfTrajectoireParameters _data, + final FSigLayerGroup dest, final GISZoneCollectionLigneBrisee lb, String _title, GISAttributeInterface _mark) { + final ZCalqueLigneBrisee la = new TrPostTrajectoireLineLayer(vue2d, _data, new ZModeleLigneBriseeDefault(lb), _mark); la.setName(BGroupeCalque.findUniqueChildName(dest, getCalqueId(_data.isTrajectoire()))); la.setTitle(CtuluLibString.isEmpty(_title) ? createNewCalqueName(_data.isTrajectoire()) : _title); la Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java 2009-01-24 21:50:40 UTC (rev 4399) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java 2009-01-24 22:16:05 UTC (rev 4400) @@ -6,10 +6,8 @@ import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; -import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Set; import javax.swing.BorderFactory; import javax.swing.JButton; @@ -19,7 +17,6 @@ import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JTextField; import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.table.DefaultTableModel; @@ -45,11 +42,9 @@ import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.TrPostFlecheContent; import org.fudaa.fudaa.tr.post.TrPostSource; +import org.fudaa.fudaa.tr.post.TrPostTrajectoireComputeAndDisplayActivity; import org.fudaa.fudaa.tr.post.TrPostTrajectoireLineLayer; -import org.fudaa.fudaa.tr.post.TrPostTrajectoireLineLayerPersist; -import org.fudaa.fudaa.tr.post.TrPostTrajectoireLineLayerPersistence; import org.fudaa.fudaa.tr.post.TrPostVisuPanel; -import org.fudaa.fudaa.tr.post.TrPostTrajectoireComputeAndDisplayActivity; import com.memoire.bu.BuComboBox; import com.memoire.bu.BuGridLayout; @@ -61,557 +56,547 @@ public class TrPostTrajectoireTaskModel implements FudaaPanelTaskModel { - /** + /** * */ - private static final double MAXDIST = 1E-3; + private static final double MAXDIST = 1E-3; - TrPostTrajectoireComputeAndDisplayActivity algoCalcul_; + TrPostTrajectoireComputeAndDisplayActivity algoCalcul_; - /** - * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque - */ + /** + * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque + */ - // ArrayList<TrPostSource> source_; - TrPostVisuPanel calque_; + // ArrayList<TrPostSource> source_; + TrPostVisuPanel calque_; - // choix mode - JComboBox choixMode_ = new JComboBox(new String[] { TrLib.getString("Lignes de courant"), - TrLib.getString("Trajectoires") }); + // choix mode + JComboBox choixMode_ = new JComboBox(new String[] { TrLib.getString("Lignes de courant"), + TrLib.getString("Trajectoires") }); - JComponent duree_; + JComponent duree_; - JComponent finesse_; + JComponent finesse_; - final MvLineChooser lineChooser_; - JComboBox cbFirstTime_; - JList listVar_; - ListModel modelPdt_; + final MvLineChooser lineChooser_; + JComboBox cbFirstTime_; + JList listVar_; + ListModel modelPdt_; - // donnees graphiques - // JDialog dialog_; + // donnees graphiques + // JDialog dialog_; - DefaultTableModel modelResult_; + DefaultTableModel modelResult_; - // results - // JPanel panelResults_; - /** - * Creation du panel graphique. - * - * @return - */ - // JPanel panelSegment_; - // finesse et duree et point - // private JPanel panelSeuil_; - // variables et pdt - // private JPanel panelVariables_; - TrPostSource source_; - CtuluValueEditorDouble doubleEditor_ = new CtuluValueEditorDouble(false); - CtuluValueEditorDouble doubleMarkEditor_ = new CtuluValueEditorDouble(false); - CtuluValueEditorInteger integerEditor_ = new CtuluValueEditorInteger(false); - JComboBox cbVitesse_; - JComponent nbPoints_; + // results + // JPanel panelResults_; + /** + * Creation du panel graphique. + * + * @return + */ + // JPanel panelSegment_; + // finesse et duree et point + // private JPanel panelSeuil_; + // variables et pdt + // private JPanel panelVariables_; + TrPostSource source_; + CtuluValueEditorDouble doubleEditor_ = new CtuluValueEditorDouble(false); + CtuluValueEditorDouble doubleMarkEditor_ = new CtuluValueEditorDouble(false); + CtuluValueEditorInteger integerEditor_ = new CtuluValueEditorInteger(false); + JComboBox cbVitesse_; + JComponent nbPoints_; - // choix segment - JComponent x_; - JComponent x2_; - JComponent y_; - JComponent y2_; - CtuluValueTimeEditor dureeEditor_; + // choix segment + JComponent x_; + JComponent x2_; + JComponent y_; + JComponent y2_; + CtuluValueTimeEditor dureeEditor_; - /** - * Constructeur reserv\xE9 au calques - * - * @param _builderParams - * @param _calque - * @param _modelGraphe - * @param _panelVariables - * @param _source - */ - public TrPostTrajectoireTaskModel(final TrPostVisuPanel calque) { - calque_ = calque; - source_ = calque.getSource(); - int nbTimeStep = source_.getNbTimeStep(); - if (nbTimeStep < 2) choixMode_.setEnabled(false); - doubleEditor_.setFormatter(CtuluNumberFormatDefault.buildNoneFormatter(3, true)); - x_ = doubleEditor_.createEditorComponent(); - x2_ = doubleEditor_.createEditorComponent(); - y_ = doubleEditor_.createEditorComponent(); - y2_ = doubleEditor_.createEditorComponent(); + /** + * Constructeur reserv\xE9 au calques + * + * @param _builderParams + * @param _calque + * @param _modelGraphe + * @param _panelVariables + * @param _source + */ + public TrPostTrajectoireTaskModel(final TrPostVisuPanel calque) { + calque_ = calque; + source_ = calque.getSource(); + int nbTimeStep = source_.getNbTimeStep(); + if (nbTimeStep < 2) choixMode_.setEnabled(false); + doubleEditor_.setFormatter(CtuluNumberFormatDefault.buildNoneFormatter(3, true)); + x_ = doubleEditor_.createEditorComponent(); + x2_ = doubleEditor_.createEditorComponent(); + y_ = doubleEditor_.createEditorComponent(); + y2_ = doubleEditor_.createEditorComponent(); - dureeEditor_ = new CtuluValueTimeEditor(); - dureeEditor_.setFmt(source_.getTimeFormatter()); - duree_ = dureeEditor_.createEditorComponent(); - double defaut = 60; - if (nbTimeStep > 2) { - defaut = (source_.getTimeStep(nbTimeStep - 1) - source_.getTimeStep(0)) / 2; - } - dureeEditor_.setValue(defaut, duree_); - integerEditor_.setVal(BuValueValidator.MIN(1)); - integerEditor_.setEditable(true); - nbPoints_ = integerEditor_.createEditorComponent(); - finesse_ = integerEditor_.createEditorComponent(); - integerEditor_.setValue(Integer.valueOf(1), nbPoints_); - integerEditor_.setValue(Integer.valueOf(1), finesse_); - lineChooser_ = new MvLineChooser(calque.getSelectedLine(), calque); - // modelVariables_ = source_.getNewVarListModel();//doit contenir les vecteurs - modelPdt_ = source_.getNewTimeListModel(); + dureeEditor_ = new CtuluValueTimeEditor(); + dureeEditor_.setFmt(source_.getTimeFormatter()); + duree_ = dureeEditor_.createEditorComponent(); + double defaut = 60; + if (nbTimeStep > 2) { + defaut = (source_.getTimeStep(nbTimeStep - 1) - source_.getTimeStep(0)) / 2; + } + dureeEditor_.setValue(defaut, duree_); + integerEditor_.setVal(BuValueValidator.MIN(1)); + integerEditor_.setEditable(true); + nbPoints_ = integerEditor_.createEditorComponent(); + finesse_ = integerEditor_.createEditorComponent(); + integerEditor_.setValue(Integer.valueOf(1), nbPoints_); + integerEditor_.setValue(Integer.valueOf(1), finesse_); + lineChooser_ = new MvLineChooser(calque.getSelectedLine(), calque); + // modelVariables_ = source_.getNewVarListModel();//doit contenir les vecteurs + modelPdt_ = source_.getNewTimeListModel(); - // -- construction de la dialog --// - } + // -- construction de la dialog --// + } + /** + * reference du layer a ecraser dans le cas ou l'on rejoue les donn\xE9es. Null si utilisation classique. + */ + TrPostTrajectoireLineLayer layerAEcraser_ = null; - /** - * reference du layer a ecraser dans le cas ou l'on rejoue les donn\xE9es. - * Null si utilisation classique. - */ - TrPostTrajectoireLineLayer layerAEcraser_=null; - /** - * Constructeur appel\xE9 pour rejouer les donn\xE9es. - * Passe en parametre la structure efTrajectoire qui contient toutes les infos de pr\xE9 remplissage - * @param calque - * @param dataReplay qui contient toutes les infos de pr\xE9 remplissage - * @param calqueAEcraser calque a ecraser en recopiant le r\xE9sultat par dessus - */ - public TrPostTrajectoireTaskModel(final TrPostVisuPanel calque,EfTrajectoireParameters dataReplay,TrPostTrajectoireLineLayer calqueAEcraser){ - this(calque); + /** + * Constructeur appel\xE9 pour rejouer les donn\xE9es. Passe en parametre la structure efTrajectoire qui contient toutes les + * infos de pr\xE9 remplissage + * + * @param calque + * @param dataReplay qui contient toutes les infos de pr\xE9 remplissage + * @param calqueAEcraser calque a ecraser en recopiant le r\xE9sultat par dessus + */ + public TrPostTrajectoireTaskModel(final TrPostVisuPanel calque, EfTrajectoireParameters dataReplay, + TrPostTrajectoireLineLayer calqueAEcraser) { + this(calque); - //-- on pr\xE9remplit les donn\xE9es avec les infos du dataReplay --// - layerAEcraser_=calqueAEcraser; + // -- on pr\xE9remplit les donn\xE9es avec les infos du dataReplay --// + layerAEcraser_ = calqueAEcraser; - //-- on reinitialise les infos avec les donn\xE9es des trajectoires/lignes de courant. --// - //-- on initialise les params graphiques --// - getPanel(); - - //-- selection du vecteur vitesse --// - for(int k=0;k<cbVitesse_.getItemCount();k++) - if( ((TrPostFlecheContent) cbVitesse_.getItemAt(k)).getVx()== dataReplay.vx) - if( ((TrPostFlecheContent) cbVitesse_.getSelectedItem()).getVy()== dataReplay.vy) - cbVitesse_.setSelectedIndex(k); + // -- on reinitialise les infos avec les donn\xE9es des trajectoires/lignes de courant. --// + // -- on initialise les params graphiques --// + getPanel(); - //-- duree itegration --// - dureeEditor_.setValue( dataReplay.dureeIntegration_, duree_); + // -- selection du vecteur vitesse --// + for (int k = 0; k < cbVitesse_.getItemCount(); k++) + if (((TrPostFlecheContent) cbVitesse_.getItemAt(k)).getVx() == dataReplay.vx) if (((TrPostFlecheContent) cbVitesse_ + .getSelectedItem()).getVy() == dataReplay.vy) cbVitesse_.setSelectedIndex(k); - //-- finesse --// - integerEditor_.setValue( dataReplay.finesse_, finesse_); + // -- duree itegration --// + dureeEditor_.setValue(dataReplay.dureeIntegration_, duree_); - //-- pas de temps initial --// - cbFirstTime_.setSelectedIndex(dataReplay.firstTimeStepIdx_); + // -- finesse --// + integerEditor_.setValue(dataReplay.finesse_, finesse_); - //-- type traj ou ligne de courant --// - if(dataReplay.isLigneDeCourant) - choixMode_.setSelectedIndex(0); - else - choixMode_.setSelectedIndex(1); - - //-- choix des variables --// - if (dataReplay.varsASuivre_.size()>1) { + // -- pas de temps initial --// + cbFirstTime_.setSelectedIndex(dataReplay.firstTimeStepIdx_); - int[] indicesToselect=new int[dataReplay.varsASuivre_.size()]; - for(int i=0;i<dataReplay.varsASuivre_.size();i++){ - - for(int k=0;k<listVar_.getModel().getSize();k++){ - if(((CtuluVariable)listVar_.getModel().getElementAt(k))==dataReplay.varsASuivre_.get(i)) - indicesToselect[i]=k; - } - } - listVar_.setSelectedIndices(indicesToselect); - } - - //-- premier point --// - doubleEditor_.setValue(dataReplay.points_.get(0).x, x_); - doubleEditor_.setValue(dataReplay.points_.get(0).y, y_); + // -- type traj ou ligne de courant --// + if (dataReplay.isLigneDeCourant) choixMode_.setSelectedIndex(0); + else choixMode_.setSelectedIndex(1); - //-- dernier point --// - doubleEditor_.setValue(dataReplay.points_.get(dataReplay.points_.size()-1).x, x2_); - doubleEditor_.setValue(dataReplay.points_.get(dataReplay.points_.size()-1).y, y2_); - - //-- marqueurs --// - if(dataReplay.marqueur_ !=null){ - if(dataReplay.marqueur_.timeStep_) - cbMarks_.setSelectedIndex(1); - else - cbMarks_.setSelectedIndex(2); - - doubleMarkEditor_.setValue(dataReplay.marqueur_.deltaMax_, markValue_); - }else - cbMarks_.setSelectedIndex(0); - - } + // -- choix des variables --// + if (dataReplay.varsASuivre_.size() > 1) { - private List<Coordinate> getPoints() { - Coordinate c = getFirsCoordinate(); - Coordinate cEnd = getEndCoordinate(); - int nbLigne = (Integer) integerEditor_.getValue(nbPoints_); - List<Coordinate> res = new ArrayList<Coordinate>(nbLigne); - if (c.distance(cEnd) < MAXDIST) { - res.add(c); - return res; - } - if (nbLigne == 1) { - c.x = (c.x + cEnd.x) / 2D; - c.y = (c.y + cEnd.y) / 2D; - res.add(c); - return res; - } - int nbIteration = nbLigne - 1; - double deltaX = (cEnd.x - c.x) / nbIteration; - double deltaY = (cEnd.y - c.y) / nbIteration; - res.add(c); - for (int i = 1; i < nbIteration; i++) { - Coordinate ci = new Coordinate(c.x + i * deltaX, c.y + i * deltaY); - res.add(ci); - } - res.add(cEnd); - return res; + int[] indicesToselect = new int[dataReplay.varsASuivre_.size()]; + for (int i = 0; i < dataReplay.varsASuivre_.size(); i++) { - } + for (int k = 0; k < listVar_.getModel().getSize(); k++) { + if (((CtuluVariable) listVar_.getModel().getElementAt(k)) == dataReplay.varsASuivre_.get(i)) indicesToselect[i] = k; + } + } + listVar_.setSelectedIndices(indicesToselect); + } - private Coordinate getEndCoordinate() { - return new Coordinate(getDoubleValue(x2_), getDoubleValue(y2_)); - } + // -- premier point --// + doubleEditor_.setValue(dataReplay.points_.get(0).x, x_); + doubleEditor_.setValue(dataReplay.points_.get(0).y, y_); - private Coordinate getFirsCoordinate() { - return new Coordinate(getDoubleValue(x_), getDoubleValue(y_)); - } + // -- dernier point --// + doubleEditor_.setValue(dataReplay.points_.get(dataReplay.points_.size() - 1).x, x2_); + doubleEditor_.setValue(dataReplay.points_.get(dataReplay.points_.size() - 1).y, y2_); - public void actTask(final ProgressionInterface _prog, final CtuluAnalyze _analyze, final String[] _messages) { - // on recupere les points - List<Coordinate> points = getPoints(); - int idxRemove = 0; - // on enleve les points en dehors - for (Iterator<Coordinate> it = points.iterator(); it.hasNext();) { - Coordinate c = it.next(); - int idx = EfIndexHelper.getElementEnglobant(source_.getGrid(), c.x, c.y, _prog); - if (idx < 0) { - idxRemove++; - it.remove(); - } - } - // si pas de point pas de calcul - if (points.size() == 0) { - _analyze.addFatalError(TrResource.getS("Aucun point de d\xE9part n'appartient au maillage")); - return; - } - if (idxRemove > 0) { - String txt = null; - if (idxRemove == 1) { - txt = TrResource.getS("1 point de d\xE9part a \xE9t\xE9 ignor\xE9 car il en dehors du maillage"); - } else { - txt = TrResource.getS("{0} points de d\xE9part ont \xE9t\xE9 ignor\xE9s car ils en dehors du maillage", CtuluLibString - .getString(idxRemove)); - } - _messages[0] = txt; - } + // -- marqueurs --// + if (dataReplay.marqueur_ != null) { + if (dataReplay.marqueur_.timeStep_) cbMarks_.setSelectedIndex(1); + else cbMarks_.setSelectedIndex(2); + doubleMarkEditor_.setValue(dataReplay.marqueur_.deltaMax_, markValue_); + } else cbMarks_.setSelectedIndex(0); - //-- creation de la donn\xE9e persistante qui a permi de creer les infos --// - // TrPostTrajectoireLineLayerPersist persist=new TrPostTrajectoireLineLayerPersist(); - // persist.setPoint1(getFirsCoordinate()); - // persist.setPoint2(getEndCoordinate()); - // persist.setTrajectoire(isTrajectoire()); - // persist.setFinesse((Integer) integerEditor_.getValue(finesse_)); - // persist.setDureeCalcul(getDuree()); - // persist.setNbCesures((Integer)integerEditor_.getValue(nbPoints_)); - Object[] selectedValues = listVar_.getSelectedValues(); - // HashSet<String> listeVar= new HashSet<String>(); - // for(int i=0;i<selectedValues.length;i++) - // listeVar.add(((CtuluVariable)selectedValues[i]).getID()); - // persist.setListeVariablesId(listeVar); - // if(isMarqueurTimeStep()) - // persist.setTypeMarqueur(1); - // else if(isMarqueurAvailable()) - // persist.setTypeMarqueur(2); - // else - // persist.setTypeMarqueur(0); - // - // creation de l algo - if(layerAEcraser_!=null) - algoCalcul_ = new TrPostTrajectoireComputeAndDisplayActivity(calque_,layerAEcraser_); - else - algoCalcul_ = new TrPostTrajectoireComputeAndDisplayActivity(calque_); + } - final TrPostFlecheContent flecheContent = getSelectedVariable(); - final EfTrajectoireParameters data = new EfTrajectoireParameters(); - data.vx = flecheContent.getVx(); - data.vy = flecheContent.getVy(); - data.dureeIntegration_ = getDuree(); - data.finesse_ = (Integer) integerEditor_.getValue(finesse_); - data.firstTimeStepIdx_ = getSelectedTimeStep(); - data.firstTimeStep_ = source_.getTimeStep(data.firstTimeStepIdx_); - data.isLigneDeCourant = isLigneCourant(); - if (!listVar_.isSelectionEmpty()) { + private List<Coordinate> getPoints() { + Coordinate c = getFirsCoordinate(); + Coordinate cEnd = getEndCoordinate(); + int nbLigne = (Integer) integerEditor_.getValue(nbPoints_); + List<Coordinate> res = new ArrayList<Coordinate>(nbLigne); + if (c.distance(cEnd) < MAXDIST) { + res.add(c); + return res; + } + if (nbLigne == 1) { + c.x = (c.x + cEnd.x) / 2D; + c.y = (c.y + cEnd.y) / 2D; + res.add(c); + return res; + } + int nbIteration = nbLigne - 1; + double deltaX = (cEnd.x - c.x) / nbIteration; + double deltaY = (cEnd.y - c.y) / nbIteration; + res.add(c); + for (int i = 1; i < nbIteration; i++) { + Coordinate ci = new Coordinate(c.x + i * deltaX, c.y + i * deltaY); + res.add(ci); + } + res.add(cEnd); + return res; - data.varsASuivre_ = new ArrayList<CtuluVariable>(selectedValues.length); - for (int i = 0; i < selectedValues.length; i++) { - data.varsASuivre_.add((CtuluVariable) selectedValues[i]); - } - } + } - data.points_ = points; - if (isMarqueurAvailable()) { - data.marqueur_ = new EfTrajectoireParametersMarqueur(); - data.marqueur_.timeStep_ = isMarqueurTimeStep(); - data.marqueur_.deltaMax_ = (Double) doubleMarkEditor_.getValue(markValue_); + private Coordinate getEndCoordinate() { + return new Coordinate(getDoubleValue(x2_), getDoubleValue(y2_)); + } - } - _messages[0] = algoCalcul_.computeLigneCourant(calque_,data, _analyze, _prog); + private Coordinate getFirsCoordinate() { + return new Coordinate(getDoubleValue(x_), getDoubleValue(y_)); + } - // -- mise a jour du tableau de res --// - // modelResult_.fireTableDataChanged(); + public void actTask(final ProgressionInterface _prog, final CtuluAnalyze _analyze, final String[] _messages) { + // on recupere les points + List<Coordinate> points = getPoints(); + int idxRemove = 0; + // on enleve les points en dehors + for (Iterator<Coordinate> it = points.iterator(); it.hasNext();) { + Coordinate c = it.next(); + int idx = EfIndexHelper.getElementEnglobant(source_.getGrid(), c.x, c.y, _prog); + if (idx < 0) { + idxRemove++; + it.remove(); + } + } + // si pas de point pas de calcul + if (points.size() == 0) { + _analyze.addFatalError(TrResource.getS("Aucun point de d\xE9part n'appartient au maillage")); + return; + } + if (idxRemove > 0) { + String txt = null; + if (idxRemove == 1) { + txt = TrResource.getS("1 point de d\xE9part a \xE9t\xE9 ignor\xE9 car il en dehors du maillage"); + } else { + txt = TrResource.getS("{0} points de d\xE9part ont \xE9t\xE9 ignor\xE9s car ils en dehors du maillage", CtuluLibString + .getString(idxRemove)); + } + _messages[0] = txt; + } - } + // -- creation de la donn\xE9e persistante qui a permi de creer les infos --// + // TrPostTrajectoireLineLayerPersist persist=new TrPostTrajectoireLineLayerPersist(); + // persist.setPoint1(getFirsCoordinate()); + // persist.setPoint2(getEndCoordinate()); + // persist.setTrajectoire(isTrajectoire()); + // persist.setFinesse((Integer) integerEditor_.getValue(finesse_)); + // persist.setDureeCalcul(getDuree()); + // persist.setNbCesures((Integer)integerEditor_.getValue(nbPoints_)); + Object[] selectedValues = listVar_.getSelectedValues(); + // HashSet<String> listeVar= new HashSet<String>(); + // for(int i=0;i<selectedValues.length;i++) + // listeVar.add(((CtuluVariable)selectedValues[i]).getID()); + // persist.setListeVariablesId(listeVar); + // if(isMarqueurTimeStep()) + // persist.setTypeMarqueur(1); + // else if(isMarqueurAvailable()) + // persist.setTypeMarqueur(2); + // else + // persist.setTypeMarqueur(0); + // + // creation de l algo + algoCalcul_ = new TrPostTrajectoireComputeAndDisplayActivity(calque_, layerAEcraser_); - JPanel content_; - JComponent markValue_; - JComboBox cbMarks_ = new JComboBox(new String[] { TrLib.getString("Aucun"), - TrLib.getString("A pas de temps constant"), TrLib.getString("A distance constante") }); + final TrPostFlecheContent flecheContent = getSelectedVariable(); + final EfTrajectoireParameters data = new EfTrajectoireParameters(); + data.vx = flecheContent.getVx(); + data.vy = flecheContent.getVy(); + data.dureeIntegration_ = getDuree(); + data.finesse_ = (Integer) integerEditor_.getValue(finesse_); + data.firstTimeStepIdx_ = getSelectedTimeStep(); + data.firstTimeStep_ = source_.getTimeStep(data.firstTimeStepIdx_); + data.isLigneDeCourant = isLigneCourant(); + if (!listVar_.isSelectionEmpty()) { - public boolean isMarqueurAvailable() { - return cbMarks_.getSelectedIndex() != 0; - } + data.varsASuivre_ = new ArrayList<CtuluVariable>(selectedValues.length); + for (int i = 0; i < selectedValues.length; i++) { + data.varsASuivre_.add((CtuluVariable) selectedValues[i]); + } + } - public boolean isMarqueurTimeStep() { - return cbMarks_.getSelectedIndex() == 1; - } + data.points_ = points; + if (isMarqueurAvailable()) { + data.marqueur_ = new EfTrajectoireParametersMarqueur(); + data.marqueur_.timeStep_ = isMarqueurTimeStep(); + data.marqueur_.deltaMax_ = (Double) doubleMarkEditor_.getValue(markValue_); - private JPanel buildMarqueur() { - doubleMarkEditor_.setVal(BuValueValidator.MIN(1E-4)); - final JPanel conteneur = new JPanel(new BuGridLayout(2, 3, 3)); - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Marqueurs"))); - conteneur.add(new JLabel(TrLib.getString("Type"))); - conteneur.add(cbMarks_); - conteneur.add(new JLabel(TrLib.getString("Delta (valeur absolue)"))); - markValue_ = doubleMarkEditor_.createEditorComponent(); - conteneur.add(markValue_); - markValue_.setEnabled(false); - cbMarks_.addItemListener(new ItemListener() { + } + _messages[0] = algoCalcul_.computeLigneCourant(calque_, data, _analyze, _prog); - public void itemStateChanged(ItemEvent _e) { - markValue_.setEnabled(isMarqueurAvailable()); + // -- mise a jour du tableau de res --// + // modelResult_.fireTableDataChanged(); - } - }); + } - return conteneur; - } + JPanel content_; + JComponent markValue_; + JComboBox cbMarks_ = new JComboBox(new String[] { TrLib.getString("Aucun"), + TrLib.getString("A pas de temps constant"), TrLib.getString("A distance constante") }); - public boolean isSegmentValid() { - final boolean segValid = !doubleEditor_.isEmpty(x_) && !doubleEditor_.isEmpty(x2_) && !doubleEditor_.isEmpty(y2_) - && !doubleEditor_.isEmpty(y_); - return segValid && integerEditor_.getValue(nbPoints_) != null; - } + public boolean isMarqueurAvailable() { + return cbMarks_.getSelectedIndex() != 0; + } - public double getDoubleValue(final JComponent c) { - return ((Double) doubleEditor_.getValue(c)).doubleValue(); - } + public boolean isMarqueurTimeStep() { + return cbMarks_.getSelectedIndex() == 1; + } - protected void updateView(final boolean _zoom) { - if (isSegmentValid()) { - lineChooser_.update(GISGeometryFactory.INSTANCE.createSegment(getDoubleValue(x_), getDoubleValue(y_), - getDoubleValue(x2_), getDoubleValue(y2_)), _zoom); - } - } + private JPanel buildMarqueur() { + doubleMarkEditor_.setVal(BuValueValidator.MIN(1E-4)); + final JPanel conteneur = new JPanel(new BuGridLayout(2, 3, 3)); + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Marqueurs"))); + conteneur.add(new JLabel(TrLib.getString("Type"))); + conteneur.add(cbMarks_); + conteneur.add(new JLabel(TrLib.getString("Delta (valeur absolue)"))); + markValue_ = doubleMarkEditor_.createEditorComponent(); + conteneur.add(markValue_); + markValue_.setEnabled(false); + cbMarks_.addItemListener(new ItemListener() { - private JPanel buildSegments() { + public void itemStateChanged(ItemEvent _e) { + markValue_.setEnabled(isMarqueurAvailable()); - final JPanel conteneur = new JPanel(new BuGridLayout(3, 5, 5, false, false, false, false, false)); - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du segment"))); - conteneur.add(new JLabel("")); - conteneur.add(new JLabel("x:")); - conteneur.add(new JLabel("y:")); - conteneur.add(new JLabel("Point 1:")); - conteneur.add(x_); - conteneur.add(y_); - conteneur.add(new JLabel("Point 2:")); - conteneur.add(x2_); - conteneur.add(y2_); - conteneur.add(new JLabel("Nombre de trajectoire/lignes de courant:")); - conteneur.add(nbPoints_); - final LineString initSelected = lineChooser_.getInitSelected(); - if (initSelected != null) { - final int nbCoordinate = initSelected.getNumPoints(); - doubleEditor_.setValue(initSelected.getCoordinateSequence().getX(0), x_); - doubleEditor_.setValue(initSelected.getCoordinateSequence().getY(0), y_); - doubleEditor_.setValue(initSelected.getCoordinateSequence().getX(nbCoordinate - 1), x2_); - doubleEditor_.setValue(initSelected.getCoordinateSequence().getY(nbCoordinate - 1), y2_); - updateView(false); - } - JPanel mainSegment = new JPanel(new BuVerticalLayout(5, false, true)); - mainSegment.add(conteneur); - JPanel pn = new JPanel(new BuGridLayout(3, 2, 0)); - JButton bt = new JButton(TrLib.getString("zoomer sur le segment")); - bt.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - updateView(true); + } + }); - } - }); - pn.add(bt); - bt = new JButton(TrLib.getString("Zoom initial")); - bt.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - lineChooser_.zoomInitial(); + return conteneur; + } - } - }); - pn.add(bt); - bt = new JButton(EbliLib.getS("Restaurer")); - bt.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - lineChooser_.restaurer(); + public boolean isSegmentValid() { + final boolean segValid = !doubleEditor_.isEmpty(x_) && !doubleEditor_.isEmpty(x2_) && !doubleEditor_.isEmpty(y2_) + && !doubleEditor_.isEmpty(y_); + return segValid && integerEditor_.getValue(nbPoints_) != null; + } - } - }); - pn.add(bt); - mainSegment.add(pn); - return mainSegment; - } + public double getDoubleValue(final JComponent c) { + return ((Double) doubleEditor_.getValue(c)).doubleValue(); + } - private JPanel buildVariables() { - final JPanel conteneur = new JPanel(new BorderLayout()); - listVar_ = new JList(source_.getNewVarListModel()); - listVar_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - conteneur.add(new JScrollPane(listVar_)); - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix des variables"))); - return conteneur; - } + protected void updateView(final boolean _zoom) { + if (isSegmentValid()) { + lineChooser_.update(GISGeometryFactory.INSTANCE.createSegment(getDoubleValue(x_), getDoubleValue(y_), + getDoubleValue(x2_), getDoubleValue(y2_)), _zoom); + } + } - public void decoreBtApply(final JButton _bt) { - _bt.setText(TrLib.getString("Calculer")); - } + private JPanel buildSegments() { - public int getNbMessageMax() { - return 1; - } + final JPanel conteneur = new JPanel(new BuGridLayout(3, 5, 5, false, false, false, false, false)); + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du segment"))); + conteneur.add(new JLabel("")); + conteneur.add(new JLabel("x:")); + conteneur.add(new JLabel("y:")); + conteneur.add(new JLabel("Point 1:")); + conteneur.add(x_); + conteneur.add(y_); + conteneur.add(new JLabel("Point 2:")); + conteneur.add(x2_); + conteneur.add(y2_); + conteneur.add(new JLabel("Nombre de trajectoire/lignes de courant:")); + conteneur.add(nbPoints_); + final LineString initSelected = lineChooser_.getInitSelected(); + if (initSelected != null) { + final int nbCoordinate = initSelected.getNumPoints(); + doubleEditor_.setValue(initSelected.getCoordinateSequence().getX(0), x_); + doubleEditor_.setValue(initSelected.getCoordinateSequence().getY(0), y_); + doubleEditor_.setValue(initSelected.getCoordinateSequence().getX(nbCoordinate - 1), x2_); + doubleEditor_.setValue(initSelected.getCoordinateSequence().getY(nbCoordinate - 1), y2_); + updateView(false); + } + JPanel mainSegment = new JPanel(new BuVerticalLayout(5, false, true)); + mainSegment.add(conteneur); + JPanel pn = new JPanel(new BuGridLayout(3, 2, 0)); + JButton bt = new JButton(TrLib.getString("zoomer sur le segment")); + bt.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + updateView(true); - public JComponent getPanel() { - if (content_ != null) return content_; - content_ = new BuPanel(new BuVerticalLayout(5)); - content_.add(buildMainProperties()); + } + }); + pn.add(bt); + bt = new JButton(TrLib.getString("Zoom initial")); + bt.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + lineChooser_.zoomInitial(); - // -- panel des segements --// - content_.add(buildSegments()); - // -- panel des variables --// - content_.add(buildVariables()); - content_.add(buildMarqueur()); - return content_; - } + } + }); + pn.add(bt); + bt = new JButton(EbliLib.getS("Restaurer")); + bt.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + lineChooser_.restaurer(); - private JPanel buildMainProperties() { - JPanel pn = new JPanel(new BuGridLayout(2, 5, 5)); - pn.add(new JLabel(TrResource.getS("Mode"))); - pn.add(choixMode_); - pn.add(new JLabel(TrResource.getS("Vecteur"))); - ListModel flecheListModel = source_.getNewFlecheListModel(); - CtuluComboBoxModelAdapter cb = new CtuluComboBoxModelAdapter(flecheListModel); - cbVitesse_ = new BuComboBox(cb); - cb.setSelectedItem(flecheListModel.getElementAt(0)); - // on s\xE9lectionne la vitesse par defaut - if (flecheListModel.getSize() > 1) { - for (int i = flecheListModel.getSize() - 1; i >= 0; i--) { - TrPostFlecheContent flecheContent = (TrPostFlecheContent) flecheListModel.getElementAt(i); - if (flecheContent.getVar() == H2dVariableType.VITESSE) { - cb.setSelectedItem(flecheListModel.getElementAt(i)); - break; - } - } - } - pn.add(cbVitesse_); - pn.add(new JLabel(TrResource.getS("Pas de temps intial"))); - cbFirstTime_ = new BuComboBox(new CtuluComboBoxModelAdapter(source_.getNewTimeListModel())); - cbFirstTime_.setSelectedIndex(0); - pn.add(cbFirstTime_); - pn.add(new JLabel(TrResource.getS("Dur\xE9e d'int\xE9gration:"))); - pn.add(duree_); - pn.add(new JLabel(TrResource.getS("Finesse:"))); - pn.add(finesse_); - return pn; - } + } + }); + pn.add(bt); + mainSegment.add(pn); + return mainSegment; + } - /** - * retourne l indice du pas de temps. - * - * @return - */ - protected int getSelectedTimeStep() { - return cbFirstTime_.getSelectedIndex(); - } + private JPanel buildVariables() { + final JPanel conteneur = new JPanel(new BorderLayout()); + listVar_ = new JList(source_.getNewVarListModel()); + listVar_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + conteneur.add(new JScrollPane(listVar_)); + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix des variables"))); + return conteneur; + } - /** - * retourne la variable selectionnee - * - * @return - */ - protected TrPostFlecheContent getSelectedVariable() { + public void decoreBtApply(final JButton _bt) { + _bt.setText(TrLib.getString("Calculer")); + } - return (TrPostFlecheContent) cbVitesse_.getSelectedItem(); - } + public int getNbMessageMax() { + return 1; + } - public String getTitre() { - return TrResource.getS("Lignes de courants") + "/" + TrResource.getS("Trajectoires"); - } + public JComponent getPanel() { + if (content_ != null) return content_; + content_ = new BuPanel(new BuVerticalLayout(5)); + content_.add(buildMainProperties()); - protected boolean isLigneCourant() { - return choixMode_.getSelectedIndex() == 0; - } + // -- panel des segements --// + content_.add(buildSegments()); + // -- panel des variables --// + content_.add(buildVariables()); + content_.add(buildMarqueur()); + return content_; + } - protected boolean isTrajectoire() { - return choixMode_.getSelectedIndex() == 1; - } + private JPanel buildMainProperties() { + JPanel pn = new JPanel(new BuGridLayout(2, 5, 5)); + pn.add(new JLabel(TrResource.getS("Mode"))); + pn.add(choixMode_); + pn.add(new JLabel(TrResource.getS("Vecteur"))); + ListModel flecheListModel = source_.getNewFlecheListModel(); + CtuluComboBoxModelAdapter cb = new CtuluComboBoxModelAdapter(flecheListModel); + cbVitesse_ = new BuComboBox(cb); + cb.setSelectedItem(flecheListModel.getElementAt(0)); + // on s\xE9lectionne la vitesse par defaut + if (flecheListModel.getSize() > 1) { + for (int i = flecheListModel.getSize() - 1; i >= 0; i--) { + TrPostFlecheContent flecheContent = (TrPostFlecheContent) flecheListModel.getElementAt(i); + if (flecheContent.getVar() == H2dVariableType.VITESSE) { + cb.setSelectedItem(flecheListModel.getElementAt(i)); + break; + } + } + } + pn.add(cbVitesse_); + pn.add(new JLabel(TrResource.getS("Pas de temps intial"))); + cbFirstTime_ = new BuComboBox(new CtuluComboBoxModelAdapter(source_.getNewTimeListModel())); + cbFirstTime_.setSelectedIndex(0); + pn.add(cbFirstTime_); + pn.add(new JLabel(TrResource.getS("Dur\xE9e d'int\xE9gration:"))); + pn.add(duree_); + pn.add(new JLabel(TrResource.getS("Finesse:"))); + pn.add(finesse_); + return pn; + } - public String isValid() { - // pas necessaire - // if (listVar_.getSelectedIndex() == -1) { return TrResource.getS("Il faut choisir une variable"); } - // if (cbFirstTime_.getSelectedIndex() == -1) { return TrResource.getS("Il faut choisir un pas de temps"); } - if (!this.integerEditor_.isValueValidFromComponent(finesse_)) { return TrResource - .getS("La finesse doit \xEAtre d\xE9fini par un entier sup\xE9rieur \xE0 1"); } - if (!isSegmentValid()) { return TrResource.getS("Le segment n'est pas d\xE9fini"); } - if (integerEditor_.getValue(nbPoints_) == null) { return TrResource.getS("Pr\xE9ciser le nombre de trajectoires"); } - if (dureeEditor_.isEmpty(duree_)) { return TrResource.getS("La dur\xE9e doit \xEAtre d\xE9finie par un r\xE9el en secondes"); } - if (isMarqueurAvailable() && !doubleMarkEditor_.isValueValidFromComponent(markValue_)) { return TrResource - .getS("Le delta du marqueur doit \xEAtre renseign\xE9"); } - // on doit verifier que la duree est bien comprise dans les pas de temps du projet - if (isTrajectoire()) { - final int duree = getDuree(); - final double timeSelected = source_.getTimeStep(cbFirstTime_.getSelectedIndex()); - final double timeEnd = timeSelected + duree; - final double lastTimeStep = source_.getTimeStep(source_.getNbTimeStep() - 1); - if (timeEnd < source_.getTimeStep(0) || timeEnd > lastTimeStep) { - final String min = "-".concat(source_.getTimeFormatter().format(timeSelected - source_.getTimeStep(0))); - final String max = source_.getTimeFormatter().format(lastTimeStep - timeSelected); - return TrResource.getS("la dur\xE9e du calcul doit \xEAtre comprise entre {0} et {1}", min, max); - } + /** + * retourne l indice du pas de temps. + * + * @return + */ + protected int getSelectedTimeStep() { + return cbFirstTime_.getSelectedIndex(); + } - } - if (getFirsCoordinate().distance(getEndCoordinate()) < MAXDIST) { - boolean res = calque_ - .getCtuluUI() - .question( - TrResource.getS("Calculer une seule trajectoire"), - TrResource - .getS("Les extremit\xE9s du segment sont confondues. Une seule trajectoire sera calcul\xE9e.\nVoulez-vous continuer ?")); - if (!res) { return TrResource.getS("Choisir 2 points diff\xE9rents"); } + /** + * retourne la variable selectionnee + * + * @return + */ + protected TrPostFlecheContent getSelectedVariable() { - } + return (TrPostFlecheContent) cbVitesse_.getSelectedItem(); + } - return null; - } + public String getTitre() { + return TrResource.getS("Lignes de courants") + "/" + TrResource.getS("Trajectoires"); + } - private Integer getDuree() { - return ((Integer) dureeEditor_.getValue(duree_)); - } + protected boolean isLigneCourant() { + return choixMode_.getSelectedIndex() == 0; + } - // EfLigneDeCourantActivity activity_; + protected boolean isTrajectoire() { + return choixMode_.getSelectedIndex() == 1; + } - public void stopTask() { - if (algoCalcul_ != null) algoCalcul_.stop(); + public String isValid() { + // pas necessaire + // if (listVar_.getSelectedIndex() == -1) { return TrResource.getS("Il faut choisir une variable"); } + // if (cbFirstTime_.getSelectedIndex() == -1) { return TrResource.getS("Il faut choisir un pas de temps"); } + if (!this.integerEditor_.isValueValidFromComponent(finesse_)) { return TrResource + .getS("La finesse doit \xEAtre d\xE9fini par un entier sup\xE9rieur \xE0 1"); } + if (!isSegmentValid()) { return TrResource.getS("Le segment n'est pas d\xE9fini"); } + if (integerEditor_.getValue(nbPoints_) == null) { return TrResource.getS("Pr\xE9ciser le nombre de trajectoires"); } + if (dureeEditor_.isEmpty(duree_)) { return TrResource.getS("La dur\xE9e doit \xEAtre d\xE9finie par un r\xE9el en secondes"); } + if (isMarqueurAvailable() && !doubleMarkEditor_.isValueValidFromComponent(markValue_)) { return TrResource + .getS("Le delta du marqueur doit \xEAtre renseign\xE9"); } + // on doit verifier que la duree est bien comprise dans les pas de temps du projet + if (isTrajectoire()) { + final int duree = getDuree(); + final double timeSelected = source_.getTimeStep(cbFirstTime_.getSelectedIndex()); + final double timeEnd = timeSelected + duree; + final double lastTimeStep = source_.getTimeStep(source_.getNbTimeStep() - 1); + if (timeEnd < source_.getTimeStep(0) || timeEnd > lastTimeStep) { + final String min = "-".concat(source_.getTimeFormatter().format(timeSelected - source_.getTimeStep(0))); + final String max = source_.getTimeFormatter().format(lastTimeStep - timeSelected); + return TrResource.getS("la dur\xE9e du calcul doit \xEAtre comprise entre {0} et {1}", min, max); + } - } + } + if (getFirsCoordinate().distance(getEndCoordinate()) < MAXDIST) { + boolean res = calque_ + .getCtuluUI() + .question( + TrResource.getS("Calculer une seule trajectoire"), + TrResource + .getS("Les extremit\xE9s du segment sont confondues. Une seule trajectoire sera calcul\xE9e.\nVoulez-vous continuer ?")); + if (!res) { return TrResource.getS("Choisir 2 points diff\xE9rents"); } - public void dialogClosed() { - lineChooser_.close(); + } - } + return null; + } + private Integer getDuree() { + return ((Integer) dureeEditor_.getValue(duree_)); + } + + // EfLigneDeCourantActivity activity_; + + public void stopTask() { + if (algoCalcul_ != null) algoCalcul_.stop(); + + } + + public void dialogClosed() { + lineChooser_.close(); + + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4404]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <de...@us...> - 2009-01-26 22:59:38
|
Revision: 4404 http://fudaa.svn.sourceforge.net/fudaa/?rev=4404&view=rev Author: deniger Date: 2009-01-26 22:59:34 +0000 (Mon, 26 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinPaletteTableModel.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/TrPostSource.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparator.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceOneTimeStep.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceProjected.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderComposite.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderInterface.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderReflux.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderSerafin.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceRubarZFN.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceSerafin.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceTelemac3D.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostUserVariableSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/actions/TrPostActionChooseAndCreateCalque.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstractFromIdx.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderCommonAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderFromFileAbstract.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderAbstract.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -32,7 +32,7 @@ import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; import org.fudaa.fudaa.tr.post.TrPostProjet; import org.fudaa.fudaa.tr.post.TrPostSource; -import org.fudaa.fudaa.tr.post.TrPostSourceAbstract; +import org.fudaa.fudaa.tr.post.TrPostSourceAbstractFromIdx; import org.fudaa.fudaa.tr.post.TrPostVisuPanel; import org.fudaa.fudaa.tr.post.TrReplayCurvesData; import org.fudaa.fudaa.tr.post.actions.TrPostProfileAction; @@ -151,7 +151,7 @@ if (this.data_ instanceof TrPostSource) { _table.put(TrResource.getS("Type"), "Profil spatial"); TrPostSource src = (TrPostSource) this.data_; - TrPostSourceAbstract.fillWithSourceInfo(_table, src); + TrPostSourceAbstractFromIdx.fillWithSourceInfo(_table, src); if (this.time_ != -1 && this.time_ < src.getNbTimeStep()) pdt += ": " + src.getTime().getTimeListModel().getElementAt(this.time_); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostBuilderSuiteCalcul.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -1,9 +1,10 @@ package org.fudaa.fudaa.tr.post; +import gnu.trove.TDoubleArrayList; + import java.awt.event.ActionEvent; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -14,291 +15,261 @@ import javax.swing.Icon; -import org.fudaa.ctulu.CtuluLibString; -import org.fudaa.ctulu.CtuluVariable; -import org.fudaa.ctulu.collection.CtuluArrayDouble; import org.fudaa.dodico.ef.EfGridInterface; import org.fudaa.dodico.h2d.type.H2dVariableType; -import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.calque.CalqueLegendeWidgetAdapter; -import org.fudaa.fudaa.commun.impl.FudaaCommonImplementation; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.TrPostSourceReaderComposite.CoupleTimeStepData; - - - /** * Builder qui construit les suites de calcul. + * * @author Adrien Hadoux - * */ public class TrPostBuilderSuiteCalcul { + /** + * Action qui r\xE9alise la suite de calcul. + * + * @author Adrien Hadoux + */ + public static class ActionBuildSuite extends EbliActionSimple { - /** - * Action qui r\xE9alise la suite de calcul. - * @author Adrien Hadoux - * - */ - public static class ActionBuildSuite extends EbliActionSimple{ + TrPostSource src_; + TrPostCommonImplementation impl_; + public ActionBuildSuite(TrPostSource src, String _name, Icon _ic, String _ac, TrPostCommonImplementation impl) { + super(_name, _ic, _ac); + // TODO Auto-generated constructor stub + src_ = src; + src_ = src; + impl_ = impl; + } - TrPostSource src_; - TrPostCommonImplementation impl_; - public ActionBuildSuite(TrPostSource src,String _name, Icon _ic, String _ac,TrPostCommonImplementation impl) { - super(_name, _ic, _ac); - // TODO Auto-generated constructor stub - src_= src; - src_=src; - impl_=impl; - } + public void actionPerformed(ActionEvent _e) { + // -- test de comptabilit\xE9 de fichier source --// + if (!isCompatibleSuiteCalcul(src_)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - public void actionPerformed(ActionEvent _e) { + // -- on lance la dialog de choix des fichiers sources --// + final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); + if (srcChoisie == null) { + impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); + return; + } + if (!isCompatibleSuiteCalcul(srcChoisie)) { + impl_.error(TrResource.getS("Le fichier n'est pas valide.")); + return; + } - //-- test de comptabilit\xE9 de fichier source --// - if(!isCompatibleSuiteCalcul(src_)){ - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + List<String> error = new ArrayList<String>(); - //-- on lance la dialog de choix des fichiers sources --// - final TrPostSource srcChoisie = impl_.getCurrentProject().getChooserMultiSources(-1); - if (srcChoisie == null) { - impl_.error(TrResource.getS(TrResource.getS("Aucune source choisie"))); - return; - } + // -- creation de la suite de calcul --// + TrPostSource suiteCalcul = createSuiteCalcul((TrPostSourceFromReader) src_, impl_, + (TrPostSourceFromReader) srcChoisie, error); - if(!isCompatibleSuiteCalcul(srcChoisie)){ - impl_.error(TrResource.getS("Le fichier n'est pas valide.")); - return; - } + if (suiteCalcul == null) { + // -- il se passe des choses \xE9tranges.... --// + String maxiStringLeo = ""; + for (String err : error) + maxiStringLeo += err + "\n"; + impl_.error(maxiStringLeo); + return; + } - List<String> error=new ArrayList<String>(); + // -- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// - //-- creation de la suite de calcul --// - TrPostSource suiteCalcul=createSuiteCalcul((TrPostSourceFromReader)src_, impl_, (TrPostSourceFromReader)srcChoisie, error); + impl_.c_.ajouterSource(suiteCalcul); - if(suiteCalcul==null){ - //-- il se passe des choses \xE9tranges.... --// - String maxiStringLeo=""; - for(String err:error) - maxiStringLeo+=err+"\n"; + // -- on cree la vue 2d correspondante --// - impl_.error(maxiStringLeo); - return; - } + TrPostProjet projet = impl_.getCurrentProject(); + TrPostLayoutPanelController controller = impl_.getCurrentLayoutFille().controller_; + final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), + null); + final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); + final EbliNode node = controller.addCalque(TrResource.getS("Calque") + + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), + pnVisu, legendeCalque); + // -- ajout de l INFO de la source utilis\xE9e --// + node.getWidget().getController().setDescription("Source: " + projet.formatInfoSource(srcChoisie)); + // -- ajout des infos de cr\xE9ation --// - //-- on ajoute la nouvelle src r\xE9sultat comme \xE9tant une suite de calcul --// + TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_, + (TrPostSourceReaderComposite) ((TrPostSourceFromReader) suiteCalcul).getReader()); - impl_.c_.ajouterSource(suiteCalcul); + } - - //-- on cree la vue 2d correspondante --// - - TrPostProjet projet=impl_.getCurrentProject(); - TrPostLayoutPanelController controller=impl_.getCurrentLayoutFille().controller_; - final CalqueLegendeWidgetAdapter legendeCalque = new CalqueLegendeWidgetAdapter(controller.getSceneCourante(), null); - final TrPostVisuPanel pnVisu = new TrPostVisuPanel(projet.getImpl(), projet, legendeCalque, suiteCalcul); - final EbliNode node = controller.addCalque(TrResource.getS("Calque") - + (controller.getSceneCourante().getAllVue2d().size() + 1), pnVisu.getLocation(), pnVisu.getPreferredSize(), - pnVisu, legendeCalque); - // -- ajout de l INFO de la source utilis\xE9e --// - node.getWidget().getController().setDescription("Source: " + projet.formatInfoSource(srcChoisie)); + } - // -- ajout des infos de cr\xE9ation --// - - TrPostSourceReaderComposite.fillInfosWithComposite(pnVisu.infosCreation_,(TrPostSourceReaderComposite)((TrPostSourceFromReader)suiteCalcul).getReader()); - - + /** + * R\xE9cup\xE9rer l'interface \xE0 partir du fichier + * + * @param _f + * @param _impl + * @return + */ + public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl) { + TrPostSource src = TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); + if (src != null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader) src); + return null; + } - } + public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { + // -- lecture de l'interface \xE0 ajouter --// + TrPostSourceFromReader srcToConcat = createSourceFromeFile(_f, _impl); + return createSuiteCalcul(_reader, _impl, srcToConcat, error); + } + /** + * Algorithme de construction d'une suite de calcul. + * + * @param srcToConcat + * @param _impl + * @param _reader + * @param error + * @return + */ + public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, + TrPostSourceFromReader _reader, List<String> error) { + TrPostSource suiteCalcul = null; + if (srcToConcat == null) { + error.add(TrResource.getS("Le fichier n'est pas valide.")); + return null; + } - } + if (_reader.isRubar() || srcToConcat.isRubar()) { + error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); + return null; + } + // -- comparaison des grilles --// + EfGridInterface grille = srcToConcat.getGrid(); + if (!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(), 0.01)) { + error.add(TrResource.getS("Les grilles ne sont pas identiques")); + return null; + } - /** - * R\xE9cup\xE9rer l'interface \xE0 partir du fichier - * @param _f - * @param _impl - * @return - */ - public static TrPostSourceFromReader createSourceFromeFile(File _f, TrPostCommonImplementation _impl){ - TrPostSource src= TrPostSourceBuilder.activeSourceAction(_f, _impl, _impl.getMainProgression()); - if(src!=null && src instanceof TrPostSourceFromReader) return ((TrPostSourceFromReader)src); - return null; + // -- comparaison des pas de temps d\xE9but et finaux --// + double[] time1 = TrPostSourceFromReader.getTimes(_reader.getReader()); + double[] time2 = TrPostSourceFromReader.getTimes(srcToConcat.getReader()); - } + if (time1[time1.length - 1] != time2[0] && time2[time2.length - 1] != time1[0]) { + error.add(TrResource + .getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); + return null; + } - public static TrPostSource createSuiteCalcul(File _f, TrPostCommonImplementation _impl, TrPostSourceFromReader _reader,List<String> error){ - //-- lecture de l'interface \xE0 ajouter --// - TrPostSourceFromReader srcToConcat=createSourceFromeFile(_f, _impl); - return createSuiteCalcul(_reader, _impl, srcToConcat, error); - } + // -- recuperation des pas de temps et des variables --// + // double[] timeTotal= new double[time1.length+time2.length-1]; + // if(time1[0]>time2[0]){ + // //-- on permute pour garder l'ordre --// + // double[] temp=time1; + // time1=time2; + // time2=temp; + // } + // for(int i=0;i<time1.length;i++) + // timeTotal[i]=time1[i]; + // for(int i=0;i<time2.length-1;i++) + // timeTotal[time1.length+i]=time2[i+1]; + HashSet<H2dVariableType> listeVar = new HashSet<H2dVariableType>(); + H2dVariableType[] var = null; + for (int i = 0; i < _reader.getAvailableVar().length; i++) + listeVar.add(_reader.getVariable(i)); + for (int i = 0; i < srcToConcat.getAvailableVar().length; i++) + listeVar.add(srcToConcat.getVariable(i)); + var = new H2dVariableType[listeVar.size()]; + int k = 0; + for (H2dVariableType v : listeVar) + var[k++] = v; - /** - * Algorithme de construction d'une suite de calcul. - * @param srcToConcat - * @param _impl - * @param _reader - * @param error - * @return - */ - public static TrPostSource createSuiteCalcul(TrPostSourceFromReader srcToConcat, TrPostCommonImplementation _impl, TrPostSourceFromReader _reader,List<String> error){ - TrPostSource suiteCalcul=null; - if(srcToConcat==null){ - error.add(TrResource.getS("Le fichier n'est pas valide.")); - return null; - } + // var=srcToConcat.variable_; + // -- initialisation de la liste de source --// + List<TrPostSourceReaderInterface> listeSourceInterface_ = new ArrayList<TrPostSourceReaderInterface>(); + // -- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// + TrPostSourceReaderInterface interface1 = _reader.reader_; + TrPostSourceReaderInterface interface2 = srcToConcat.reader_; - if(_reader.isRubar() || srcToConcat.isRubar()){ - error.add(TrResource.getS("Format Rubar non g\xE9r\xE9")); - return null; - } + // -- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// + if (interface1 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface1).listeSourceInterface_); + else listeSourceInterface_.add(interface1); - //-- comparaison des grilles --// - EfGridInterface grille=srcToConcat.getGrid(); - if(!grille.isSameStrict(_reader.getGrid(), _impl.getMainProgression(),0.01)){ - error.add(TrResource.getS("Les grilles ne sont pas identiques")); - return null; - } + if (interface2 instanceof TrPostSourceReaderComposite) listeSourceInterface_ + .addAll(((TrPostSourceReaderComposite) interface2).listeSourceInterface_); + else listeSourceInterface_.add(interface2); - //-- comparaison des pas de temps d\xE9but et finaux --// - double[] time1=TrPostSourceFromReader.getTimes(_reader.getReader()); - double[] time2=TrPostSourceFromReader.getTimes(srcToConcat.getReader()); + // -- ajout de tous les fichiers dans la collection --// + final Collection<File> file_ = new HashSet<File>(interface1.getFiles());; + file_.addAll(interface2.getFiles()); - if(time1[time1.length-1]!=time2[0] && time2[time2.length-1]!=time1[0]){ - error.add(TrResource.getS("Le dernier pas de temps de l'un doit \xEAtre \xE9quivalent au premier pas de temps de l'autre.")); - return null; - } + // -- on trie les listes dans l'ordre des timestep --// + Collections.sort(listeSourceInterface_, new ComparateurTrPostSourceReaderInterface()); + // - ajout des correspondances timestep/source avec nouveau timestep --// + Map<Integer, CoupleTimeStepData> mapTimeStep_ = new HashMap<Integer, CoupleTimeStepData>(); + // TODO utilise TDoubleArrayList + TDoubleArrayList times = new TDoubleArrayList(); + // int cpt = 0; + for (TrPostSourceReaderInterface data : listeSourceInterface_) { + for (int i = 0; i < data.getNbTimeStep(); i++) { + // LOGIquement, il faudrait prendre en compte les erreurs d'arrondi + // -- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// + if (!times.contains(data.getTimeStep(i))) { + // le cpt vaut la taille des times + mapTimeStep_.put(times.size(), new CoupleTimeStepData(data, i)); + times.add(data.getTimeStep(i)); + // cpt++; + } + } + } - //-- recuperation des pas de temps et des variables --// - // double[] timeTotal= new double[time1.length+time2.length-1]; - // if(time1[0]>time2[0]){ - // //-- on permute pour garder l'ordre --// - // double[] temp=time1; - // time1=time2; - // time2=temp; - // } - // for(int i=0;i<time1.length;i++) - // timeTotal[i]=time1[i]; - // for(int i=0;i<time2.length-1;i++) - // timeTotal[time1.length+i]=time2[i+1]; + double[] timeTotal = times.toNativeArray(); + // -- creation de la suite de calcul + TrPostSourceReaderComposite suite = new TrPostSourceReaderComposite(timeTotal, var, mapTimeStep_, + listeSourceInterface_, file_); - HashSet<H2dVariableType> listeVar=new HashSet<H2dVariableType>(); - H2dVariableType[] var=null; - for(int i=0;i<_reader.getAvailableVar().length;i++) - listeVar.add(_reader.getVariable(i)); - for(int i=0;i<srcToConcat.getAvailableVar().length;i++) - listeVar.add(srcToConcat.getVariable(i)); - var=new H2dVariableType[listeVar.size()]; - int k=0; - for(H2dVariableType v:listeVar) - var[k++]=v; + // -- creation du source Reader --// + return new TrPostSourceFromReader(suite, TrResource.getS("Suite de calcul"), grille, _impl); + } + /** + * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. + * + * @param src + * @return + */ + public static boolean isCompatibleSuiteCalcul(TrPostSource src) { - //var=srcToConcat.variable_; + if (src != null && src instanceof TrPostSourceFromReader) return true; + return false; + } - //-- initialisation de la liste de source --// - List<TrPostSourceReaderInterface> listeSourceInterface_=new ArrayList<TrPostSourceReaderInterface>(); + public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface> { - //-- on ajoute \xE0 la liste des interfaces l'interface 1 et l'intrface 2 --// - TrPostSourceReaderInterface interface1=_reader.reader_; - TrPostSourceReaderInterface interface2=srcToConcat.reader_; + public int compare(TrPostSourceReaderInterface o1, TrPostSourceReaderInterface o2) { + // -- on compare selon la valeur des timesteps -- + if (o1.getTimeStep(0) > o2.getTimeStep(0)) return 1; - //-- attetion au cas particulier: si une interface1 est deja une suite, il faut ajouter toutes ses interfaces --// - if(interface1 instanceof TrPostSourceReaderComposite) - listeSourceInterface_.addAll(((TrPostSourceReaderComposite)interface1).listeSourceInterface_); - else - listeSourceInterface_.add(interface1); + if (o1.getTimeStep(0) < o2.getTimeStep(0)) return -1; - if(interface2 instanceof TrPostSourceReaderComposite) - listeSourceInterface_.addAll(((TrPostSourceReaderComposite)interface2).listeSourceInterface_); - else - listeSourceInterface_.add(interface2); + return 0; + } - //-- ajout de tous les fichiers dans la collection --// - final Collection<File> file_=new HashSet<File>(interface1.getFiles());; - file_.addAll(interface2.getFiles()); + } - - //-- on trie les listes dans l'ordre des timestep --// - Collections.sort(listeSourceInterface_,new ComparateurTrPostSourceReaderInterface()); - - //- ajout des correspondances timestep/source avec nouveau timestep --// - Map<Integer, CoupleTimeStepData> mapTimeStep_=new HashMap<Integer, CoupleTimeStepData>(); - ArrayList<Double> times=new ArrayList<Double>(); - int cpt=0; - for(TrPostSourceReaderInterface data:listeSourceInterface_){ - for(int i=0;i<data.getNbTimeStep();i++){ - - //-- ICI, pour cet algo, on doit degager tout les doublons et ne conserver que des valeurs uniques --// - if(!times.contains(data.getTimeStep(i))){ - mapTimeStep_.put(cpt,new CoupleTimeStepData(data,i)); - times.add(data.getTimeStep(i)); - cpt++; - } - } - } - - double[] timeTotal=new double[times.size()]; - for(int i=0;i<times.size();i++) - timeTotal[i]=times.get(i); - - //-- creation de la suite de calcul - TrPostSourceReaderComposite suite=null; - - suite=new TrPostSourceReaderComposite(timeTotal,var,mapTimeStep_,listeSourceInterface_,file_); - - //-- creation du source Reader --// - suiteCalcul=new TrPostSourceFromReader(suite,TrResource.getS("Suite de calcul"),grille,_impl); - - return suiteCalcul; - } - - - /** - * Methode appelee pour v\xE9rifier que ceci est bien compatible avec la suite de calcul. - * @param src - * @return - */ - public static boolean isCompatibleSuiteCalcul(TrPostSource src){ - - if(src!=null && src instanceof TrPostSourceFromReader) - return true; - return false; - } - - public static class ComparateurTrPostSourceReaderInterface implements Comparator<TrPostSourceReaderInterface>{ - - @Override - public int compare(TrPostSourceReaderInterface o1, - TrPostSourceReaderInterface o2) { - - //-- on compare selon la valeur des timesteps -- - if(o1.getTimeStep(0)>o2.getTimeStep(0)) - return 1; - - if(o1.getTimeStep(0)<o2.getTimeStep(0)) - return -1; - - - return 0; - } - - } - } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -401,7 +401,7 @@ public void fillWithInfo(InfoData _table, CtuluListSelectionInterface _selectedPt) { if(EbliWidget.AMELIO_LOT_VISIBLE){ _table.put(TrResource.getS("Type"),"Evolution temporelle"); - TrPostSourceAbstract.fillWithSourceInfo(_table, source_); + TrPostSourceAbstractFromIdx.fillWithSourceInfo(_table, source_); _table.put(TrResource.getS("Titre Fichier r\xE9sultat"),this.source_.getTitle()); _table.put(TrResource.getS("Infos Point initial"),this.getInfosPoint()); _table.put(TrResource.getS("Variable"),this.getVar().getName()+" en "+this.getVar().getCommonUnitString()); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -328,19 +328,19 @@ // -- ajout du rectangle --// final EbliNodeDefault nodeFleche = new EbliNodeDefault(); nodeFleche.setTitle("Fleche simple"); - //nodeFleche.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFlecheSimple())); - + // nodeFleche.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFlecheSimple())); + nodeFleche.setCreator(new EbliWidgetCreatorArrowEditor(new EbliEditorArrow())); - + nodeFleche.setPreferedSize(new Dimension(200, 150)); nodeFleche.setPreferedLocation(new Point(350, 125)); // ajout du node au layout addNode(nodeFleche); - //nodeFleche.getWidget().repaint(); - //((EbliWidgetArrowEditor)nodeFleche.getWidget()).editor_.creationFlecheClassique(); - + // nodeFleche.getWidget().repaint(); + // ((EbliWidgetArrowEditor)nodeFleche.getWidget()).editor_.creationFlecheClassique(); + return nodeFleche; } @@ -432,8 +432,8 @@ }); // -- palette fleche simple--// - _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Editeur Fleche"), - EbliResource.EBLI.getToolIcon("crystal_bu_link"), "WIDGETFLECHESIMPLE") { + _l.add(new EbliActionSimple(EbliResource.EBLI.getString("Editeur Fleche"), EbliResource.EBLI + .getToolIcon("crystal_bu_link"), "WIDGETFLECHESIMPLE") { @Override public void actionPerformed(final ActionEvent _evt) { addFlecheSimple(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinPaletteTableModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinPaletteTableModel.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostMinPaletteTableModel.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -24,9 +24,9 @@ H2dVariableType[] vs_; boolean[] activated_; Double[] value_; - TrPostSourceAbstract s_; + TrPostSource s_; - TrPostMinPaletteTableModel(final TrPostSourceAbstract _s) { + TrPostMinPaletteTableModel(final TrPostSource _s) { s_ = _s; vs_ = _s.getVarToDefinedMinPalette(); activated_ = _s.getMinPaletteActived(vs_); 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-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -9,6 +9,7 @@ import java.awt.Component; import java.awt.Dimension; +import java.awt.EventQueue; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -400,7 +401,7 @@ } } - + public TrPostSource findSource(final String _file) { return findSource(new File(_file)); } @@ -432,9 +433,9 @@ private boolean isOpenedIn(Collection<File> files, TrPostSource _in) { if (_in == null) return false; - boolean sourceGetAllFiles=true; + boolean sourceGetAllFiles = true; for (File file : files) { - if (!_in.isOpened(file)) sourceGetAllFiles=false;; + if (!_in.isOpened(file)) sourceGetAllFiles = false;; } return sourceGetAllFiles; @@ -609,9 +610,9 @@ ic, TrPostProjet.this)); menuSimul.addSeparator(); - - - listSousMenus.add(menuSimul.addMenuItem(new TrPostBuilderSuiteCalcul.ActionBuildSuite(_src,TrResource.getS("Suite de calcul"),EbliResource.EBLI.getIcon(""),"SUITECALCUL",impl_))); + + listSousMenus.add(menuSimul.addMenuItem(new TrPostBuilderSuiteCalcul.ActionBuildSuite(_src, TrResource + .getS("Suite de calcul"), EbliResource.EBLI.getIcon(""), "SUITECALCUL", impl_))); listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Comparer..."), "COMPARE", ic, TrPostProjet.this)); listSousMenus.get(listSousMenus.size() - 1).setToolTipText( TrResource.getS("Comparer les r\xE9sultats avec ceux d'un autre projet")); @@ -890,7 +891,7 @@ // -- ajout des infos de cr\xE9ation --// // TODO centralise tout cela \xFC!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - TrPostSourceAbstract.fillWithSourceInfo(CtuluLibString.EMPTY_STRING, pnVisu.infosCreation_, projection); + TrPostSourceAbstractFromIdx.fillWithSourceInfo(CtuluLibString.EMPTY_STRING, pnVisu.infosCreation_, projection); pnVisu.infosCreation_.put(ZEbliCalquesPanel.TITRE_FIC, projection.getTitle()); // creation de l internalframe qui contient le panel de visu @@ -1168,11 +1169,13 @@ } // -- lancement du thread d'ouverture du layout avec els widgets calque - new CtuluTaskOperationGUI(impl_, TrResource.getS("Ouverture vue 2D...")) { + // TODO pourquoi faire un thread pour des operation graphiques !!!!!!!!!!!!!!!!!!!!!!!! + // new CtuluTaskOperationGUI(impl_, TrResource.getS("Ouverture vue 2D...")) { - @Override - public void act() { + Runnable r = new Runnable() { + public void run() { + // -- si il y a deja une source de pr\xE9charg\xE9e --// if (listeSrc_.size() > 0) { final TrPostLayoutFille filleLayout = new TrPostLayoutFille(TrPostProjet.this); @@ -1185,7 +1188,7 @@ // -- ajout des infos de cr\xE9ation --// // TODO Adrien centralise tout cela !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // c'est la source qui doit donner ces info: modifier TrPostSource ! - TrPostSourceAbstract.fillWithSourceInfo(CtuluLibString.EMPTY_STRING, pnVisu.infosCreation_, source); + TrPostSourceAbstractFromIdx.fillWithSourceInfo(CtuluLibString.EMPTY_STRING, pnVisu.infosCreation_, source); // -- ajout du visuPanel au layout --// final Point location = pnVisu.getLocation(); @@ -1206,9 +1209,11 @@ // -- creation du menu POST de base --// setMenuPost(); + changedMainFrameState(); } - }.start(Thread.MAX_PRIORITY); - changedMainFrameState(); + }; + EventQueue.invokeLater(r); + } public void changedMainFrameState() { 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-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSource.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -49,12 +49,10 @@ */ public interface TrPostSource extends EfGridData, FudaaSavable { - public String getId(); - + public void setId(String id); - - + public void activate(); EfGridDataInterpolator getInterpolator(); @@ -70,11 +68,11 @@ void buildDefaultVarUpdateLists(); -// TrPostInspectorReader createWatcher(TrPostProjet _proj, boolean _auto); + // TrPostInspectorReader createWatcher(TrPostProjet _proj, boolean _auto); -// boolean isInspectable(); + // boolean isInspectable(); -// void setInspected(boolean _b); + // void setInspected(boolean _b); boolean isInspected(); @@ -302,8 +300,6 @@ void updateUserValue(final H2dVariableTypeCreated _old, final H2dVariableTypeCreated _new, final TrPostDataCreated _newData, final CtuluCommandContainer _cmd); - - /** * @param _analyze permet d'initialise la base temporaire. */ @@ -312,4 +308,28 @@ void addSpecificItemInMainMenu(final BuMenu _m, TrPostCommonImplementation _impl); TrPostVisuPanel buildVisuPanel(TrPostProjet _parent, BCalqueLegende _legende); + + /** + * @return + */ + H2dVariableType[] getVarToDefinedMinPalette(); + + /** + * @param _v + * @return + */ + boolean[] getMinPaletteActived(H2dVariableType[] _v); + + /** + * @param _v + * @return + */ + double[] getMinPaletteValues(H2dVariableType[] _v); + + /** + * @param _v + * @param _actived + * @param _d + */ + void setDefaultPaletteMinPalette(H2dVariableType[] _v, boolean[] _actived, double[] _d); } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -7,9 +7,6 @@ */ package org.fudaa.fudaa.tr.post; -import gnu.trove.TObjectIntHashMap; -import gnu.trove.TObjectIntIterator; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -92,11 +89,15 @@ */ public abstract class TrPostSourceAbstract implements TrPostSource { + public boolean isRubar() { + return false; + } + public TrPostVisuPanel buildVisuPanel(final TrPostProjet _parent, final BCalqueLegende _legende) { return new TrPostVisuPanel(_parent.getImpl(), _parent, _legende, this); } - - public static Collection<File> getFiles(File _file){ + + public static Collection<File> getFiles(File _file) { return Collections.unmodifiableCollection(Arrays.asList(_file)); } @@ -207,8 +208,6 @@ TrPostDataInfoDoc info_; - TObjectIntHashMap initVarIdx_; - protected boolean inspected_; EfGridDataInterpolator interpolator_; @@ -238,6 +237,8 @@ InterpolationVectorContainer vectors_; + Collection<H2dVariableType> initVar_; + protected TrPostSourceAbstract(final String _titre, final EfGridInterface _g, final double[] _time, final H2dVariableType[] _v, final CtuluUI _impl) { title_ = _titre; @@ -248,6 +249,7 @@ time_.setTimeSteps(_time); g_ = _g; impl_ = _impl; + setInitVar(_v); } @@ -256,9 +258,9 @@ protected final void addFroud(final Map _l) { if (getInitDataIndex("FROUDE") != null) { return; } // les variables h,u et v doivent etre d\xE9finies - if ((getInitDataIndex(H2dVariableType.HAUTEUR_EAU) >= 0 || _l.containsKey(H2dVariableType.HAUTEUR_EAU)) - && (getInitDataIndex(H2dVariableType.VITESSE_U) >= 0 || _l.containsKey(H2dVariableType.VITESSE_U)) - && (getInitDataIndex(H2dVariableType.VITESSE_V) >= 0 || _l.containsKey(H2dVariableType.VITESSE_V))) { + if ((isInitVar(H2dVariableType.HAUTEUR_EAU) || _l.containsKey(H2dVariableType.HAUTEUR_EAU)) + && (isInitVar(H2dVariableType.VITESSE_U) || _l.containsKey(H2dVariableType.VITESSE_U)) + && (isInitVar(H2dVariableType.VITESSE_V) || _l.containsKey(H2dVariableType.VITESSE_V))) { final H2dVariableTypeCreated c = H2dVariableType.createTempVar(H2dResource.getS("Nombre de Froude"), "froude", shortNameCreateVar_); _l.put(c, new TrPostDataCreatedFroud(this)); @@ -271,28 +273,27 @@ * * @param _map */ - final void addInitData(final TObjectIntHashMap _map) { - if (_map == null || _map.size() == 0) { return; } - if (initVarIdx_ == null) { - initVarIdx_ = new TObjectIntHashMap(_map.size()); - } - final TObjectIntIterator it = _map.iterator(); - final Set l = new HashSet(_map.size()); - for (int i = _map.size(); i-- > 0;) { - it.advance(); - final Object var = it.key(); - if (!initVarIdx_.containsKey(var)) { - l.add(var); - initVarIdx_.put(var, it.value()); - } - } - // pas de modif - if (l.size() == 0) { return; } - buildDefaultVectors(); - updateVarList(); - fireFlecheListModelChanged(); - } - + // final void addInitData(final TObjectIntHashMap _map) { + // if (_map == null || _map.size() == 0) { return; } + // if (initVarIdx_ == null) { + // initVarIdx_ = new TObjectIntHashMap(_map.size()); + // } + // final TObjectIntIterator it = _map.iterator(); + // final Set l = new HashSet(_map.size()); + // for (int i = _map.size(); i-- > 0;) { + // it.advance(); + // final Object var = it.key(); + // if (!initVarIdx_.containsKey(var)) { + // l.add(var); + // initVarIdx_.put(var, it.value()); + // } + // } + // // pas de modif + // if (l.size() == 0) { return; } + // buildDefaultVectors(); + // updateVarList(); + // fireFlecheListModelChanged(); + // } protected void addOtherVariables(final Map _l, final Map _fleche) { addFroud(_l); } @@ -384,52 +385,42 @@ final Map nameFleche = new HashMap(); varCreateData_ = new HashMap(); // par defaut vitesse et debit - int idx = getInitDataIndex(H2dVariableType.VITESSE_U); - if (idx >= 0) { - final int idxY = getInitDataIndex(H2dVariableType.VITESSE_V); - if (idxY >= 0) { + if (isInitVar(H2dVariableType.VITESSE_U)) { + if (isInitVar(H2dVariableType.VITESSE_V)) { final TrPostFlecheContent vec = createSimpleVecteurContent(H2dVariableType.VITESSE, H2dVariableType.VITESSE_U, H2dVariableType.VITESSE_V, isRubar()); nameFleche.put(H2dVariableType.VITESSE, vec); - if (getInitDataIndex(H2dVariableType.VITESSE) < 0) { + if (!isInitVar(H2dVariableType.VITESSE)) { varCreateData_.put(H2dVariableType.VITESSE, vec); } } } - idx = getInitDataIndex(H2dVariableType.DEBIT_X); - if (idx >= 0) { - final int idxY = getInitDataIndex(H2dVariableType.DEBIT_Y); - if (idxY >= 0) { + if (isInitVar(H2dVariableType.DEBIT_X)) { + if (isInitVar(H2dVariableType.DEBIT_Y)) { final TrPostFlecheContent vec = createSimpleVecteurContent(H2dVariableType.DEBIT, H2dVariableType.DEBIT_X, H2dVariableType.DEBIT_Y, isRubar()); nameFleche.put(H2dVariableType.DEBIT, vec); - if (getInitDataIndex(H2dVariableType.DEBIT) < 0) { + if (!isInitVar(H2dVariableType.DEBIT)) { varCreateData_.put(H2dVariableType.DEBIT, vec); } } } - idx = getInitDataIndex(H2dVariableType.COTE_EAU); - final int idxBath = getInitDataIndex(H2dVariableType.BATHYMETRIE); - final int idxH = getInitDataIndex(H2dVariableType.HAUTEUR_EAU); - if (idx < 0) { - if (idxBath >= 0 && idxH >= 0) { + if (!isInitVar(H2dVariableType.COTE_EAU)) { + if (isInitVar(H2dVariableType.BATHYMETRIE) && isInitVar(H2dVariableType.HAUTEUR_EAU)) { varCreateData_.put(H2dVariableType.COTE_EAU, new TrPostDataCreatedPlus(this, H2dVariableType.BATHYMETRIE, H2dVariableType.HAUTEUR_EAU)); } } // sinon on cree la hauteur d'eau - else if (idxH < 0 && idxBath >= 0) { + else if (!isInitVar(H2dVariableType.HAUTEUR_EAU) && isInitVar(H2dVariableType.BATHYMETRIE)) { varCreateData_.put(H2dVariableType.HAUTEUR_EAU, new TrPostDataCreatedMoins(this, H2dVariableType.COTE_EAU, H2dVariableType.BATHYMETRIE)); } - if (initVarIdx_ != null) { - final TObjectIntIterator it = initVarIdx_.iterator(); - for (int i = initVarIdx_.size(); i-- > 0;) { - it.advance(); - // int idxInit = it.value(); - final H2dVariableType vi = (H2dVariableType) it.key(); + Collection<H2dVariableType> vars = getInitVar(); + if (vars != null) { + for (H2dVariableType vi : vars) { final String name = vi.getName(); if (name.endsWith("X") && vi != H2dVariableType.DEBIT_X && vi != H2dVariableType.SXX) { final H2dVariableType idxY = getInitDataIndex(name.substring(0, name.length() - 1) + 'Y'); @@ -498,8 +489,7 @@ } } - protected TrPostDataMinMaxGlobalItem computeMinMax(final H2dVariableType _variable, - final ProgressionInterface _prog) { + protected TrPostDataMinMaxGlobalItem computeMinMax(final H2dVariableType _variable, final ProgressionInterface _prog) { final ProgressionUpdater up = createUpdaterForMinMax(_variable); final TrPostExtremVisitor visitor = new TrPostExtremVisitor(isRubar() ? getGrid().getEltNb() : getGrid().getPtsNb()); for (int i = getNbTimeStep() - 1; i >= 0; i--) { @@ -534,6 +524,10 @@ return up; } + protected Collection<H2dVariableType> getInitVar() { + return initVar_; + } + protected final InterpolationVectorContainer createVectorInterpolation() { if (vectors_ == null) { vectors_ = new InterpolationVectorContainer(); @@ -669,18 +663,15 @@ public EfData getData(final H2dVariableType _variable, final int _timeStep) { if (_timeStep < 0) { return null; } - final int init = getInitDataIndex(_variable); - if (init >= 0) { return getInitData(init, _timeStep); } + if (isInitVar(_variable)) return getInitData(_variable, _timeStep); if (isCreatedVar(_variable)) { return ((TrPostDataCreated) varCreateData_.get(_variable)).getDataFor(_timeStep); } if (isUserCreatedVar(_variable)) { return ((TrPostDataCreated) varUserCreateData_.get(_variable)) .getDataFor(_timeStep); } return null; } - public double getData(final H2dVariableType _variable, final int _timeStep, final int _idxPt) - throws IOException { - final int init = getInitDataIndex(_variable); - if (init >= 0) { return getInitData(init, _timeStep, _idxPt); } + public double getData(final H2dVariableType _variable, final int _timeStep, final int _idxPt) throws IOException { + if (isInitVar(_variable)) return getInitData(_variable, _timeStep, _idxPt); if (isCreatedVar(_variable)) { return ((TrPostDataCreated) varCreateData_.get(_variable)).getValue(_timeStep, _idxPt); } if (isUserCreatedVar(_variable)) { return ((TrPostDataCreated) varUserCreateData_.get(_variable)).getValue( @@ -850,21 +841,24 @@ return g_; } - public abstract EfData getInitData(int _varIdx, int _timeIdx); + public abstract EfData getInitData(H2dVariableType _varIdx, int _timeIdx); - public abstract double getInitData(int _varIdx, int _timeIdx, int _ptIdx) throws IOException; + public abstract double getInitData(H2dVariableType _varIdx, int _timeIdx, int _ptIdx) throws IOException; - protected final int getInitDataIndex(final H2dVariableType _t) { - if (initVarIdx_ != null && _t != null && initVarIdx_.contains(_t)) { return initVarIdx_.get(_t); } - return -1; + protected final boolean isInitVar(final H2dVariableType _t) { + return getInitVar().contains(_t); } + // protected final int getInitDataIndex(final H2dVariableType _t) { + // if (initVarIdx_ != null && _t != null && initVarIdx_.contains(_t)) { return initVarIdx_.get(_t); } + // return -1; + // } + protected final H2dVariableType getInitDataIndex(final String _varName) { - if (initVarIdx_ != null) { - final TObjectIntIterator it = initVarIdx_.iterator(); - for (int i = initVarIdx_.size(); i-- > 0;) { - it.advance(); - if (((H2dVariableType) it.key()).getName().equals(_varName)) { return (H2dVariableType) it.key(); } + Collection<H2dVariableType> vars = getInitVar(); + if (vars != null) { + for (H2dVariableType variableType : vars) { + if (variableType.getName().equals(_varName)) { return variableType; } } } return null; @@ -989,15 +983,6 @@ return variable_.length; } - public final H2dVariableType getVariableWithInitIdx(final int _idx) { - final TObjectIntIterator it = initVarIdx_.iterator(); - for (int i = initVarIdx_.size(); i-- > 0;) { - it.advance(); - if (it.value() == _idx) { return (H2dVariableType) it.key(); } - } - return null; - } - /** * @return un model representant les pas de temps */ @@ -1091,9 +1076,7 @@ } public final boolean isDefined(final H2dVariableType _variable) { - final int init = getInitDataIndex(_variable); - if (init >= 0) { return true; } - return isCreatedVar(_variable) || isUserCreatedVar(_variable); + return isInitVar(_variable) || isCreatedVar(_variable) || isUserCreatedVar(_variable); } public final boolean isElementVar(final CtuluVariable _idxVar) { @@ -1156,8 +1139,8 @@ return -1; } - public boolean openDatas(final ProgressionInterface _int, final CtuluAnalyze _analyze, - final ObjectContainer _db, final CtuluUI _ui) { + public boolean openDatas(final ProgressionInterface _int, final CtuluAnalyze _analyze, final ObjectContainer _db, + final CtuluUI _ui) { if (_db == null) { return false; } if (tmpContainer_ != null) { FuLog.error("the database is already opened", new Throwable()); @@ -1327,17 +1310,12 @@ } } - protected final void setInitVar(final H2dVariableType[] _v) { + protected void setInitVar(final H2dVariableType[] _v) { + initVar_ = Collections.unmodifiableCollection(Arrays.asList(_v)); variable_ = _v; if (variable_ == null) { variable_ = new H2dVariableType[0]; } - if (variable_.length > 0) { - initVarIdx_ = new TObjectIntHashMap(variable_.length); - for (int i = variable_.length - 1; i >= 0; i--) { - initVarIdx_.put(variable_[i], i); - } - } } @@ -1400,7 +1378,7 @@ } protected void updateVarList() { - final Set r = initVarIdx_ == null ? new HashSet() : new HashSet(Arrays.asList(initVarIdx_.keys())); + final Set r = initVar_ == null ? new HashSet() : new HashSet(initVar_); if (FuLog.isDebug()) { FuLog.debug("nb var creee auto " + varCreateData_.size()); } @@ -1442,32 +1420,33 @@ idx++; } } - public static void fillWithSourceInfo(String _pref,Map _table, TrPostSource src) { - + + public static void fillWithSourceInfo(String _pref, Map _table, TrPostSource src) { + Collection<File> files = src.getFiles(); int idx = 1; - String pref=_pref==null?CtuluLibString.EMPTY_STRING:_pref; + String pref = _pref == null ? CtuluLibString.EMPTY_STRING : _pref; for (File file : files) { String suffixe = files.size() > 1 ? CtuluLibString.getEspaceString(idx) : CtuluLibString.EMPTY_STRING; - _table.put(pref+TrResource.getS("Fichier r\xE9sultat") + suffixe, file.getName()); - _table.put(pref+TrResource.getS("Chemin complet") + suffixe, file.getAbsolutePath()); - _table.put(pref+TrResource.getS("Titre Fichier r\xE9sultat") + suffixe, src.getTitle()); + _table.put(pref + TrResource.getS("Fichier r\xE9sultat") + suffixe, file.getName()); + _table.put(pref + TrResource.getS("Chemin complet") + suffixe, file.getAbsolutePath()); + _table.put(pref + TrResource.getS("Titre Fichier r\xE9sultat") + suffixe, src.getTitle()); idx++; } } - - public static void fillWithSourceInfo(String _pref,Map _table, TrPostSourceReaderInterface src) { - - Collection<File> files = src.getFiles(); - int idx = 1; - String pref=_pref==null?CtuluLibString.EMPTY_STRING:_pref; - for (File file : files) { - String suffixe = files.size() > 1 ? CtuluLibString.getEspaceString(idx) : CtuluLibString.EMPTY_STRING; - _table.put(pref+TrResource.getS("Fichier r\xE9sultat") + suffixe, file.getName()); - _table.put(pref+TrResource.getS("Chemin complet") + suffixe, file.getAbsolutePath()); - // _table.put(pref+TrResource.getS("Titre Fichier r\xE9sultat") + suffixe, s); - idx++; - } - } - + + public static void fillWithSourceInfo(String _pref, Map _table, TrPostSourceReaderInterface src) { + + Collection<File> files = src.getFiles(); + int idx = 1; + String pref = _pref == null ? CtuluLibString.EMPTY_STRING : _pref; + for (File file : files) { + String suffixe = files.size() > 1 ? CtuluLibString.getEspaceString(idx) : CtuluLibString.EMPTY_STRING; + _table.put(pref + TrResource.getS("Fichier r\xE9sultat") + suffixe, file.getName()); + _table.put(pref + TrResource.getS("Chemin complet") + suffixe, file.getAbsolutePath()); + // _table.put(pref+TrResource.getS("Titre Fichier r\xE9sultat") + suffixe, s); + idx++; + } + } + } \ No newline at end of file Copied: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstractFromIdx.java (from rev 4403, branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstractFromIdx.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstractFromIdx.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -0,0 +1,82 @@ +/* + * @creation 24 mars 2004 + * @modification $Date: 2007-06-28 09:28:18 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.fudaa.tr.post; + +import gnu.trove.TObjectIntHashMap; +import gnu.trove.TObjectIntIterator; + +import java.io.IOException; + +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.ef.EfGridInterface; +import org.fudaa.dodico.h2d.type.H2dVariableType; + +/** + * @author Fred Deniger + * @version $Id: TrPostSourceAbstract.java,v 1.52 2007-06-28 09:28:18 deniger Exp $ + */ +public abstract class TrPostSourceAbstractFromIdx extends TrPostSourceAbstract { + + TObjectIntHashMap initVarIdx_; + + protected TrPostSourceAbstractFromIdx(final String _titre, final EfGridInterface _g, final double[] _time, + final H2dVariableType[] _v, final CtuluUI _impl) { + super(_titre, _g, _time, _v, _impl); + setInitVar(_v); + } + + public void activate() {} + + + + public abstract EfData getInitData(int _varIdx, int _timeIdx); + + public abstract double getInitData(int _varIdx, int _timeIdx, int _ptIdx) throws IOException; + + protected final int getInitDataIndex(final H2dVariableType _t) { + if (initVarIdx_ != null && _t != null && initVarIdx_.contains(_t)) { return initVarIdx_.get(_t); } + return -1; + } + + protected final void setInitVar(final H2dVariableType[] _v) { + super.setInitVar(_v); + if (variable_.length > 0) { + initVarIdx_ = new TObjectIntHashMap(variable_.length); + for (int i = variable_.length - 1; i >= 0; i--) { + initVarIdx_.put(variable_[i], i); + } + } + + } + + public final H2dVariableType getVariableWithInitIdx(final int _idx) { + final TObjectIntIterator it = initVarIdx_.iterator(); + for (int i = initVarIdx_.size(); i-- > 0;) { + it.advance(); + if (it.value() == _idx) { return (H2dVariableType) it.key(); } + } + return null; + } + + @Override + public double getInitData(H2dVariableType _varIdx, int _timeIdx, int _ptIdx) throws IOException { + final int init = getInitDataIndex(_varIdx); + if (init >= 0) { return getInitData(init, _timeIdx, _ptIdx); } + return 0; + } + + @Override + public EfData getInitData(H2dVariableType _varIdx, int _timeIdx) { + final int init = getInitDataIndex(_varIdx); + if (init >= 0) { return getInitData(init, _timeIdx); } + return null; + } + + +} \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparator.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparator.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -37,7 +37,7 @@ * @author Fred Deniger * @version $Id: TrPostSourceComparator.java,v 1.12 2007-06-05 09:01:14 deniger Exp $ */ -public final class TrPostSourceComparator extends TrPostSourceAbstract { +public final class TrPostSourceComparator extends TrPostSourceAbstractFromIdx { private H2dVariableType[] srcVariable_; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceComparatorBuilder.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -187,10 +187,10 @@ // -- ajout des infos de cr\xE9ation --// String pref = TrResource.getS("Source") + " "; infosCreation_.put(pref + ZEbliCalquesPanel.TITRE_FIC, src.getTitle()); - TrPostSourceAbstract.fillWithSourceInfo(pref, infosCreation_, src); + TrPostSourceAbstractFromIdx.fillWithSourceInfo(pref, infosCreation_, src); pref = TrResource.getS("Projet\xE9") + " "; infosCreation_.put(pref + ZEbliCalquesPanel.TITRE_FIC, proj.getTitle()); - TrPostSourceAbstract.fillWithSourceInfo(pref, infosCreation_, proj); + TrPostSourceAbstractFromIdx.fillWithSourceInfo(pref, infosCreation_, proj); if (isOnImpGrid) infosCreation_.put(ZEbliCalquesPanel.MAILLAGE_FIC, proj.getTitle()); else infosCreation_.put(ZEbliCalquesPanel.MAILLAGE_FIC, src.getTitle()); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceDefault.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceDefault.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -20,7 +20,7 @@ * @author Fred Deniger * @version $Id: TrPostSourceDefault.java,v 1.16 2006-10-27 10:24:42 deniger Exp $ */ -public final class TrPostSourceDefault extends TrPostSourceAbstract { +public final class TrPostSourceDefault extends TrPostSourceAbstractFromIdx { private final EfData[][] datas_; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceFromReader.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -18,7 +18,7 @@ /** * @author deniger */ -public class TrPostSourceFromReader extends TrPostSourceAbstract { +public class TrPostSourceFromReader extends TrPostSourceAbstract{ TrPostSourceReaderInterface reader_; @@ -54,24 +54,6 @@ - @Override - public EfData getInitData(int _varIdx, int _timeIdx) { - return reader_.getInitData(_varIdx, _timeIdx); - } - - @Override - public double getInitData(int _varIdx, int _timeIdx, int _ptIdx) throws IOException { - return reader_.getInitData(_varIdx, _timeIdx, _ptIdx); - } - -// public TrPostInspectorReader createWatcher(TrPostProjet _proj, boolean _auto) { -// return reader_.createWatcher(_proj, _auto); -// } - - public boolean isRubar() { - return false; - } - public Collection<File> getFiles() { return reader_.getFiles(); } @@ -90,4 +72,19 @@ reader_ = _reader; } + @Override + public EfData getInitData(H2dVariableType _varIdx, int _timeIdx) { + return reader_.getInitData(_varIdx, _timeIdx); + } + + @Override + public double getInitData(H2dVariableType _varIdx, int _timeIdx, int _ptIdx) throws IOException { + return reader_.getInitData(_varIdx, _timeIdx, _ptIdx); + } + + + public boolean isRubar() { + return false; + } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceOneTimeStep.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceOneTimeStep.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceOneTimeStep.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -21,7 +21,7 @@ * @author fred deniger * @version $Id: TrPostSourceOneTimeStep.java,v 1.4 2007-06-05 09:01:14 deniger Exp $ */ -public class TrPostSourceOneTimeStep extends TrPostSourceAbstract { +public class TrPostSourceOneTimeStep extends TrPostSourceAbstractFromIdx { final int timeStep_; final TrPostSource init_; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceProjected.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceProjected.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceProjected.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -42,7 +42,7 @@ * @author Fred Deniger * @version $Id: TrPostSourceProjected.java,v 1.14 2007-06-28 09:28:18 deniger Exp $ */ -public class TrPostSourceProjected extends TrPostSourceAbstract { +public class TrPostSourceProjected extends TrPostSourceAbstractFromIdx { final boolean destIsRubar_; Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderAbstract.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderAbstract.java 2009-01-26 18:36:56 UTC (rev 4403) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceReaderAbstract.java 2009-01-26 22:59:34 UTC (rev 4404) @@ -1,74 +0,0 @@ -/** - * @creation 24 mars 2004 - * @modification $Date: 2007-05-04 14:01:52 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... - */ -package org.fudaa.fudaa.tr.post; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.fudaa.dodico.ef.EfData; -import org.fudaa.dodico.ef.EfDataNode; -import org.fudaa.dodico.h2d.type.H2dVariableType; -import org.fudaa.dodico.telemac.io.SerafinNewReaderInfo; - -import com.memoire.fu.FuLog; - -/** - * @author Fred Deniger - * @version $Id: TrPostSourceSerafin.java,v 1.15 2007-05-04 14:01:52 deniger Exp $ - */ -public abstract class TrPostSourceReaderAbstract implements TrPostSourceReaderInterface { - - Collection<File> file_; - final double[] times_; - final List<H2dVariableType> initVar_; - - protected TrPostSourceReaderAbstract(final File _file, final double[] _time, H2dVariableType[] _initVar) { - file_ = Collections.unmodifiableCollection(Arrays.asList(_file)); - times_ = _time; - initVar_ = Collections.unmodifiableList(Arrays.asList(_initVar)); - } - - protected TrPostSourceReaderAbstract(Collection<File> _file, final double[] _time, H2dVariableType[] _initVar) { - file_ = _file; - times_ = _time; - initVar_ = Collections.unmo... [truncated message content] |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4432]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <had...@us...> - 2009-01-30 18:59:47
|
Revision: 4432 http://fudaa.svn.sourceforge.net/fudaa/?rev=4432&view=rev Author: hadouxad Date: 2009-01-30 18:59:41 +0000 (Fri, 30 Jan 2009) Log Message: ----------- Liste des am?\195?\169liorations: - Superposition: modification de la pile des frames: actions accessibles via clic droit sur les frame: monter, descendre, en premier, en dernier (comme pour les graphes et vues 2d) - Correction bugs rejoue des donn?\195?\169es pour les trajectoires/lignes de courant - Action origine de la courbe: un Bouton offre la possibilit?\195?\169 de cr?\195?\169er la frame de la vue de la fen?\195?\170tre et de l'ins?\195?\169rer automatiquement dans le layout. Cette action permet de visualiser la frame avec l'origine de la cr?\195?\169ation de la courbe pour plus de visibilit?\195?\169 par l'utilisateur : un calque est automatiquement g?\195?\169n?\195?\169r?\195?\169 avec les informations g?\195?\169om?\195?\169triques qui porte le nom de la courbe. -Assistant cr?\195?\169ation graphe: cr?\195?\169er automatiquement une trace dans la vue 2d: propose par d?\195?\169faut un flag qui g?\195?\169n?\195?\168re automatiquement le calque avec les donn?\195?\169es d'origine du graphe dans la vue 2d, permet de conserver une trace. Propose de saisir un titre pr?\195?\169 remplit. - Ajout du panel rechercher directement a cote de l'interface de modif pour l'action rejouer les donn?\195?\169es Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContent.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardProfilSpatial.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-30 18:55:31 UTC (rev 4431) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-01-30 18:59:41 UTC (rev 4432) @@ -160,13 +160,39 @@ _table.put(MvResource.getS("Pas de temps"), pdt); LineString polyligne = builder_.getInitLine(); - if (polyligne != null) { + if (polyligne != null && polyligne.getNumPoints()>0) { _table.put(MvResource.getS("Polyligne, nb pts"), Integer.toString(polyligne.getNumPoints())); - _table.put(MvResource.getS("Point d\xE9but"), "(" + formater.getFormatter().format(polyligne.getCoordinateN(0).x) - + ";" + formater.getFormatter().format(polyligne.getCoordinateN(0).y) + ")"); - _table.put(MvResource.getS("Point fin"), "(" - + formater.getFormatter().format(polyligne.getCoordinateN(polyligne.getNumPoints() - 1).x) + ";" - + formater.getFormatter().format(polyligne.getCoordinateN(polyligne.getNumPoints() - 1).y) + ")"); + + String ptDebut="("; + if( formater!=null && formater.getFormatter()!=null) + ptDebut+= formater.getFormatter().format(polyligne.getCoordinateN(0).x); + else + ptDebut+=polyligne.getCoordinateN(0).x; + ptDebut+= ";"; + if( formater!=null && formater.getFormatter()!=null) + ptDebut+= formater.getFormatter().format(polyligne.getCoordinateN(0).y); + else + ptDebut+=polyligne.getCoordinateN(0).y; + ptDebut+= ")"; + + _table.put(MvResource.getS("Point d\xE9but"), ptDebut); + + int fin=polyligne.getNumPoints() - 1; + String ptFin="("; + if( formater!=null && formater.getFormatter()!=null) + ptFin+= formater.getFormatter().format(polyligne.getCoordinateN(fin).x); + else + ptFin+=polyligne.getCoordinateN(fin).x; + ptFin+= ";"; + if( formater!=null && formater.getFormatter()!=null) + ptFin+= formater.getFormatter().format(polyligne.getCoordinateN(fin).y); + else + ptFin+=polyligne.getCoordinateN(fin).y; + ptFin+= ")"; + + _table.put(MvResource.getS("Point fin"), ptFin); + + } 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-30 18:55:31 UTC (rev 4431) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-01-30 18:59:41 UTC (rev 4432) @@ -79,7 +79,13 @@ */ public TrPostLayoutFille getCurrentLayoutFille() { final JInternalFrame currentInternalFrame = getCurrentInternalFrame(); - return currentInternalFrame instanceof TrPostLayoutFille ? (TrPostLayoutFille) currentInternalFrame : null; + if( currentInternalFrame instanceof TrPostLayoutFille) + return (TrPostLayoutFille) currentInternalFrame; + else{ + //-- on recherche la premiere file layout qu'on a et on l'envoie --// + //-- ACHTUNG: CAS A TRAITER:EXEMPLE SI ON EST DANS LA FRAME GESTION MULTI SOURCE; ON EST PAS DANS LA CURRENT LAYOUT MAIS ON S EN FOUT--// + return getAllLayoutFille().get(0); + } } /** @@ -129,6 +135,7 @@ setEnabledForAction("ENREGISTRER", true); setEnabledForAction("ENREGISTRERSOUS", true); setEnabledForAction("IMPORTER", true); + setEnabledForAction("RECHERCHER", true); setEnabledForAction(getImportResultsAct(), true); setEnabledForAction("IMPORT_PROJECT", true); } @@ -298,6 +305,7 @@ setEnabledForAction("IMPORTER", true); setEnabledForAction(getImportResultsAct(), true); setEnabledForAction("IMPORT_PROJECT", true); + setEnabledForAction("RECHERCHER", true); } }); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContent.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContent.java 2009-01-30 18:55:31 UTC (rev 4431) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostFlecheContent.java 2009-01-30 18:59:41 UTC (rev 4432) @@ -36,6 +36,9 @@ H2dVariableType getVy(); + + + /** * @return un clone de l'objet */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-01-30 18:55:31 UTC (rev 4431) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java 2009-01-30 18:59:41 UTC (rev 4432) @@ -9,6 +9,7 @@ import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridLayout; +import java.awt.Point; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -17,9 +18,11 @@ import java.text.DecimalFormat; import java.util.Arrays; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.Vector; @@ -32,6 +35,8 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.JSplitPane; +import javax.swing.JTabbedPane; import javax.swing.JTable; import javax.swing.JToolBar; import javax.swing.table.DefaultTableModel; @@ -56,13 +61,19 @@ import org.fudaa.ebli.calque.edition.ZCalqueLigneBriseeEditable; import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; import org.fudaa.ebli.calque.edition.ZModelePointEditable; +import org.fudaa.ebli.commun.EbliActionAbstract; import org.fudaa.ebli.commun.EbliActionInterface; +import org.fudaa.ebli.commun.EbliActionMap; import org.fudaa.ebli.commun.EbliActionPaletteAbstract; +import org.fudaa.ebli.commun.EbliActionSimple; import org.fudaa.ebli.commun.EbliComponentFactory; import org.fudaa.ebli.controle.BSelecteurListComboBox; import org.fudaa.ebli.courbe.EGGrapheTreeModel; import org.fudaa.ebli.courbe.EGModel; +import org.fudaa.ebli.find.EbliFindDialog; +import org.fudaa.ebli.find.EbliFindableItem; import org.fudaa.ebli.palette.BPaletteInfo; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.trace.TraceIcon; import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.trace.TraceLigneModel; @@ -80,6 +91,7 @@ import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardImportScope; import org.openide.util.actions.Presenter.Toolbar; +import com.memoire.bu.Bu; import com.memoire.bu.BuBorderLayout; import com.memoire.bu.BuBorders; import com.memoire.bu.BuButton; @@ -87,6 +99,7 @@ import com.memoire.bu.BuList; import com.memoire.bu.BuPanel; import com.memoire.bu.BuRadioButton; +import com.memoire.bu.BuResource; import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuToolBar; import com.memoire.bu.BuWizardDialog; @@ -174,11 +187,11 @@ - public JToolBar constructToolBarVue2d(TrPostVisuPanel vue2d,boolean modeEdition){ + public JToolBar constructToolBarVue2d(final TrPostVisuPanel vue2d,boolean modeEdition){ JToolBar toolbarCalque = new BuToolBar(); AbstractButton boutonSelection=null; //final EbliActionInterface[] actions =vue2d.getController().getSelectedNavigationAndStandardActionGroup(); - final List actions = vue2d.getController().getSelectedNavigationAndStandardActionGroup(); + final List actions = vue2d.getController().getActions();//getSelectedNavigationAndStandardActionGroup(); int i=0; for (final Iterator iterator = actions.iterator(); iterator.hasNext();) { // for (int i=0;i<actions.length;i++) { @@ -200,6 +213,16 @@ final ZCalqueSondeInteraction sonde = vue2d.getController().addCalqueSondeInteraction(); toolbarCalque.add(new CalqueActionSonde(sonde, vue2d.getArbreCalqueModel())); + //--ajout de l'action rechercher--// + EbliActionAbstract action=new EbliActionSimple("Rechercher",EbliResource.EBLI.getIcon("rechercher"),"RECH"){ + public void actionPerformed(final ActionEvent _e) { + vue2d.find(); + } + }; + + + toolbarCalque.add(action); + //-- activer par d\xE9faut l'action selection de points --// if(boutonSelection!=null) boutonSelection.doClick(); @@ -247,7 +270,7 @@ * @param implementation * @param modele */ - private TrReplayDialog constructDialog(TrPostVisuPanel vue2d, TrPostCommonImplementation implementation, EGModel modele,JComponent composantAdditionnel,boolean modeEdition,String title){ + private TrReplayDialog constructDialog(final TrPostVisuPanel vue2d, final TrPostCommonImplementation implementation,final EGModel modele,JComponent composantAdditionnel,boolean modeEdition,String title){ implementation.createTask(TrResource.getS("Origine ")+" "+modele.getTitle()); final TrReplayDialog pn = new TrReplayDialog(false); pn.setLayout(new BuBorderLayout()); @@ -264,7 +287,7 @@ JPanel panelSouth2=new JPanel(new FlowLayout(FlowLayout.LEFT)); panelSouth.add(vue2d.getLabelSuiviSouris()); - JPanel panelTotalSouth=new JPanel(new GridLayout(3,1)); + final JPanel panelTotalSouth=new JPanel(new GridLayout(3,1)); if(title!=null){ panelTotalSouth.add(new JLabel(title)); @@ -302,7 +325,17 @@ compEast.add(comp,BuBorderLayout.SOUTH); } } - pn.add(compEast,BuBorderLayout.EAST); + EbliFindDialog dialog= new EbliFindDialog(vue2d); + dialog.setSelectedFindAction((EbliFindableItem)vue2d.getCalqueActif()); + JTabbedPane panelEAST=new JTabbedPane(); + + //panelEAST.add(compEast,BorderLayout.CENTER); +// panelEAST.setTopComponent(dialog); +// panelEAST.setBottomComponent(compEast); + panelEAST.addTab("Rechercher", dialog); + panelEAST.addTab("Infos Points, Variables", compEast); + //pn.add(dialog,BorderLayout.WEST); + pn.add(panelEAST,BuBorderLayout.EAST); panelSouth.add(this.ecraser_); panelSouth.add(this.ajouter_); //final JScrollPane arbreVue2d = new JScrollPane(new BArbreCalque(vue2d.getArbreCalqueModel())); @@ -316,6 +349,22 @@ } + }else{ + + //-- ajout de l'action de cr\xE9ation de la vue 2d correspondante --// + EbliActionSimple genereVue2d=new EbliActionSimple( EbliResource.EBLI.getString("G\xE9n\xE9rer la frame dans le layout"), BuResource.BU.getToolIcon("crystal_graphe"), "WIDGETRECALQUE"){ + + public void actionPerformed(ActionEvent e){ + TrPostLayoutFille fille=implementation.getCurrentLayoutFille(); + if(fille==null) + { + implementation.error("Il n'existe pas de layout..."); + return; + } + fille.addCalque("Origine courbe:"+modele.getTitle(), new Point(100,100),new Dimension(300,300),vue2d/*.duplicate(new HashMap())*/,new CalqueLegendeWidgetAdapter(fille.getScene(),vue2d.getArbreCalqueModel())); + } + }; + panelSouth2.add(genereVue2d.buildButton(EbliComponentFactory.INSTANCE)); } @@ -365,7 +414,9 @@ calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.PLUS,4,Color.blue)); else calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,3,Color.blue)); - vue2d.addCalque(calqueZ, true); + calqueZ.setTitle("Origine courbe de "+modele.getTitle()); + // vue2d.addCalque(calqueZ, true); + vue2d.getGroupGIS().add(calqueZ); calqueZ.setVisible(true); vue2d.setCalqueActif(memoire); //-- on affiche le contenu dans une dialog--// @@ -417,7 +468,9 @@ //calqueZ.setVisible(true); //calqueZ.setLineModel(0, new TraceLigneModel(1,2,Color.BLACK)); calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,3,Color.blue)); - vue2d.addCalque(calqueZ, true); + calqueZ.setTitle("Origine courbe de "+modele.getTitle()); + //vue2d.addCalque(calqueZ, true); + vue2d.getGroupGIS().add(calqueZ); calqueZ.setVisible(true); vue2d.setCalqueActif(memoire); //-- on affiche le contenu dans une dialog--// @@ -455,6 +508,7 @@ public int afficheModale(final Component _parent, final String _t, final int _option) { dialog_= createDialog(_parent); + dialog_.setModal(false); dialog_.setInitParent(_parent); dialog_.setOption(_option); if (_t != null) { @@ -517,7 +571,8 @@ //groupeCalque.addPointLayerAct("Origine", new GISZoneCollectionPoint()); BCalque resultatsCalque=vue2d.getCalqueActif(); - vue2d.addCalque(layer2, true); + //vue2d.addCalque(layer2, true); + vue2d.getGroupGIS().add(layer2); vue2d.setCalqueActif(resultatsCalque); //vue2d.addCalque(layer2, true); @@ -719,7 +774,8 @@ layer2.setEnabled(true); BCalque resultatsCalque=vue2d.getCalqueActif(); - vue2d.addCalque(layer2, true); + //vue2d.addCalque(layer2, true); + vue2d.getGroupGIS().add(layer2); vue2d.setCalqueActif(resultatsCalque); //-- creation du panel de choix des variables a selectionner --// Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java 2009-01-30 18:55:31 UTC (rev 4431) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostTrajectoireTaskModel.java 2009-01-30 18:59:41 UTC (rev 4432) @@ -46,6 +46,8 @@ import org.fudaa.fudaa.tr.post.TrPostTrajectoireLineLayer; import org.fudaa.fudaa.tr.post.TrPostVisuPanel; +import sun.security.action.GetLongAction; + import com.memoire.bu.BuComboBox; import com.memoire.bu.BuGridLayout; import com.memoire.bu.BuPanel; @@ -211,12 +213,12 @@ } // -- premier point --// - doubleEditor_.setValue(dataReplay.points_.get(0).x, x_); - doubleEditor_.setValue(dataReplay.points_.get(0).y, y_); - + doubleEditor_.setValue(dataReplay.segment_.get(0).x, x_); + doubleEditor_.setValue(dataReplay.segment_.get(0).y, y_); + integerEditor_.setValue(dataReplay.nbPointsInitiaux_,nbPoints_); // -- dernier point --// - doubleEditor_.setValue(dataReplay.points_.get(dataReplay.points_.size() - 1).x, x2_); - doubleEditor_.setValue(dataReplay.points_.get(dataReplay.points_.size() - 1).y, y2_); + doubleEditor_.setValue(dataReplay.segment_.get(dataReplay.segment_.size() - 1).x, x2_); + doubleEditor_.setValue(dataReplay.segment_.get(dataReplay.segment_.size() - 1).y, y2_); // -- marqueurs --// if (dataReplay.marqueur_ != null) { @@ -318,6 +320,11 @@ final TrPostFlecheContent flecheContent = getSelectedVariable(); final EfTrajectoireParameters data = new EfTrajectoireParameters(); + data.segment_=new ArrayList<Coordinate>(); + data.segment_.add(getFirsCoordinate()); + data.segment_.add(getEndCoordinate()); + data.nbPointsInitiaux_=(Integer) integerEditor_.getValue(nbPoints_); + data.vx = flecheContent.getVx(); data.vy = flecheContent.getVy(); data.dureeIntegration_ = getDuree(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java 2009-01-30 18:55:31 UTC (rev 4431) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java 2009-01-30 18:59:41 UTC (rev 4432) @@ -1,6 +1,7 @@ package org.fudaa.fudaa.tr.post.dialogSpec; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; @@ -26,20 +27,29 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.JTextField; import javax.swing.table.AbstractTableModel; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.CtuluTaskDelegate; import org.fudaa.ctulu.ProgressionInterface; import org.fudaa.ctulu.gis.GISPrecision; +import org.fudaa.ctulu.gis.GISZoneCollectionPoint; +import org.fudaa.ctulu.gui.CtuluDialog; +import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.ctulu.image.CtuluLibImage; import org.fudaa.dodico.ef.operation.EfIndexHelper; import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.ZCalquePoint; +import org.fudaa.ebli.calque.edition.ZModelePointEditable; import org.fudaa.ebli.courbe.EGGraphe; import org.fudaa.ebli.courbe.EGGrapheModel; import org.fudaa.ebli.geometrie.GrPoint; import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.trace.TraceIcon; +import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.ebli.visuallibrary.EbliNode; import org.fudaa.ebli.visuallibrary.EbliScene; import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetCreatorGraphe; @@ -60,11 +70,13 @@ import com.memoire.bu.BuButtonPanel; import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuGridLayout; import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuStringValidator; import com.memoire.bu.BuTextField; import com.memoire.bu.BuValueValidator; import com.memoire.bu.BuWizardTask; +import com.vividsolutions.jts.geom.Coordinate; /** * Wizard reserv\xE9 pour la creation de courbes temporelles. @@ -155,12 +167,10 @@ * les points selectionnes */ // private int[] ptIdx_; - BuCheckBox checkboxNewGraphe_ = new BuCheckBox(TrResource.TR.getString("Cr\xE9er un nouveau graphe")/* - * , EbliResource . - * EBLI . getIcon ( - * "crystal_valider" - * ) - */); + BuCheckBox checkboxNewGraphe_ = new BuCheckBox(TrResource.TR.getString("Cr\xE9er un nouveau graphe")); + + BuCheckBox traceOrigineDansVue2d_ = new BuCheckBox(TrResource.TR.getString("Cr\xE9er un calque avec les points d'origine de la courbe dans la vue 2d")); + private final MvExportChooseVarAndTime chooserVarTime_; // TrPostActionAddPointFromWidgetCalque.Temporel actionChoixGraphes_; @@ -286,6 +296,9 @@ bouttonCenter.add(checkboxNewGraphe_); main.add(bouttonCenter, BorderLayout.NORTH); + + panelControle.add(traceOrigineDansVue2d_); + traceOrigineDansVue2d_.setSelected(true); return main; } @@ -431,7 +444,55 @@ } } + /** + * Creer une trace de l'origine du graphe sous forme dd calque + */ + private void creerTraceCalque(){ + CtuluDialogPanel pn = new CtuluDialogPanel(false); + pn.setLayout(new BuGridLayout(2)); + pn.addLabel(TrLib.getString("Indiquer le nom du calque \xE0 cr\xE9er")); + JTextField tf = pn.addStringText(); + tf.setColumns(10); + tf.setText("Origine \xE9volution temporelle"); + pn.afficheModale(CtuluLibSwing.getActiveWindow(),"Trace de l'origine du graphe", CtuluDialog.OK_OPTION); + String titreCalque = tf.getText(); + + //-- cas interpol\xE9 --// + TrPostInterpolatePoint[] listeInterpol=getAllPOintsInt(); + if(listeInterpol!=null && listeInterpol.length>0){ + GISZoneCollectionPoint collectionPoint=new GISZoneCollectionPoint(); + for(int i=0;i<listeInterpol.length;i++) + collectionPoint.add(listeInterpol[i].getX(), listeInterpol[i].getY(),0); + ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); + ZCalquePoint calqueZ=new ZCalquePoint(modelePointEdit); + calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.PLUS,4,Color.blue)); + calqueZ.setTitle(titreCalque+" Interpol\xE9s"); + calque_.getGroupGIS().add(calqueZ); + } + //-- cas reels --// + int[] listeReels=getAllPOintsReels(); + if(listeReels!=null && listeReels.length>0){ + GISZoneCollectionPoint collectionPoint=new GISZoneCollectionPoint(); + for(int i=0;i<listeReels.length;i++){ + + Coordinate coor=calque_.getSource().getGrid().getCoor(listeReels[i]); + collectionPoint.add(coor.x,coor.y,0); + } + ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); + ZCalquePoint calqueZ=new ZCalquePoint(modelePointEdit); + calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,3,Color.blue)); + calqueZ.setTitle(titreCalque+" Noeuds R\xE9els"); + calque_.getGroupGIS().add(calqueZ); + } + + + + + + } + + /** * appel\xE9 a la fin du wizard */ @Override @@ -448,6 +509,11 @@ // -- creation du model pour les donn\xE9es fournies --// final TrPostCourbeTreeModel modelTotal = createCourbeModel(prog); + //-- on enregistre les calques initiaux dans le graphe + if(traceOrigineDansVue2d_.isSelected()){ + creerTraceCalque(); + } + // -- creation d un nouveau graphe si coch\xE9 --// if (checkboxNewGraphe_.isSelected()) createNewGraphe(modelTotal, prog); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardProfilSpatial.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardProfilSpatial.java 2009-01-30 18:55:31 UTC (rev 4431) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardProfilSpatial.java 2009-01-30 18:59:41 UTC (rev 4432) @@ -1,18 +1,27 @@ package org.fudaa.fudaa.tr.post.dialogSpec; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.FlowLayout; import javax.swing.JComponent; import javax.swing.JPanel; +import javax.swing.JTextField; import org.fudaa.ctulu.CtuluLib; import org.fudaa.ctulu.CtuluTaskDelegate; import org.fudaa.ctulu.CtuluVariable; +import org.fudaa.ctulu.gis.GISZoneCollectionPoint; +import org.fudaa.ctulu.gui.CtuluDialog; +import org.fudaa.ctulu.gui.CtuluDialogPanel; import org.fudaa.ctulu.gui.CtuluLibSwing; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.ebli.calque.ZCalquePoint; +import org.fudaa.ebli.calque.edition.ZModelePointEditable; import org.fudaa.ebli.courbe.EGGraphe; +import org.fudaa.ebli.trace.TraceIcon; +import org.fudaa.ebli.trace.TraceIconModel; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.profile.MvProfileBuilderFromTree; import org.fudaa.fudaa.meshviewer.profile.MvProfileFillePanel; @@ -20,6 +29,7 @@ import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; +import org.fudaa.fudaa.tr.post.TrPostInterpolatePoint; import org.fudaa.fudaa.tr.post.TrPostScene; import org.fudaa.fudaa.tr.post.TrPostSource; import org.fudaa.fudaa.tr.post.TrPostVisuPanel; @@ -27,7 +37,10 @@ import com.memoire.bu.BuButtonPanel; import com.memoire.bu.BuCheckBox; +import com.memoire.bu.BuGridLayout; import com.memoire.bu.BuWizardTask; +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.LineString; /** * classe reservee a la creation de profils spatiaux via un wizard. @@ -51,13 +64,9 @@ MvProfileBuilderFromTree builderParams_; - BuCheckBox checkboxNewGraphe_ = new BuCheckBox(TrResource.TR.getString("Cr\xE9er un nouveau graphe")/* - * , EbliResource . - * EBLI . getIcon ( - * "crystal_valider" - * ) - */); - + BuCheckBox checkboxNewGraphe_ = new BuCheckBox(TrResource.TR.getString("Cr\xE9er un nouveau graphe")); + BuCheckBox traceOrigineDansVue2d_ = new BuCheckBox(TrResource.TR.getString("Cr\xE9er un calque avec les points d'origine de la courbe dans la vue 2d")); + private final TrPostVisuPanel calque_; TrPostSource src_; public TrPostWizardProfilSpatial(final TrPostVisuPanel _calque, final MvProfileBuilderFromTree _chooserParam, final TrPostActionAddPointFromWidgetCalque.Spatial _actionChoixGraphes) { @@ -65,6 +74,7 @@ builderParams_ = _chooserParam; // calque_ = _calque; src_ = _calque.getSource(); + calque_=_calque; } @Override @@ -97,7 +107,45 @@ }); } + + /** + * Creer une trace de l'origine du graphe sous forme dd calque + */ + private void creerTraceCalque(){ + CtuluDialogPanel pn = new CtuluDialogPanel(false); + pn.setLayout(new BuGridLayout(2)); + pn.addLabel(TrLib.getString("Indiquer le nom du calque \xE0 cr\xE9er")); + JTextField tf = pn.addStringText(); + tf.setColumns(10); + tf.setText("Origine profil spatial"); + pn.afficheModale(CtuluLibSwing.getActiveWindow(),"Trace de l'origine du graphe", CtuluDialog.OK_OPTION); + String titreCalque = tf.getText(); + + + + //-- cas reels --// + LineString listePoints=builderParams_.selectedLine_; + + GISZoneCollectionPoint collectionPoint=new GISZoneCollectionPoint(); + + for(int i=0;i<listePoints.getNumPoints();i++) + collectionPoint.add(listePoints.getCoordinateN(i).x,listePoints.getCoordinateN(i).y,0); + + ZModelePointEditable modelePointEdit=new ZModelePointEditable(collectionPoint); + ZCalquePoint calqueZ=new ZCalquePoint(modelePointEdit); + calqueZ.setIconModel(0, new TraceIconModel(TraceIcon.CARRE_SELECTION,3,Color.blue)); + calqueZ.setTitle(titreCalque); + calque_.getGroupGIS().add(calqueZ); + + + + + + } + + + /** * appel\xE9 a la fin du wizard */ @Override @@ -105,13 +153,24 @@ builderParams_.close(); done_ = true; + + // -- creation d un nouveau graphe si coch\xE9 --// if (checkboxNewGraphe_.isSelected()) createNewGraphe(); + + //-- on enregistre les calques initiaux dans le graphe + if(traceOrigineDansVue2d_.isSelected()){ + creerTraceCalque(); + } + final TrPostCommonImplementation impl = getPostImpl(); // -- ajout des courbes dans les graphes --// for (int i = 0; i < this.actionChoixGraphes_.listeGraphesChoisis.size(); i++) { final EGGraphe graphe = this.actionChoixGraphes_.listeGraphesChoisis.get(i); + + + // -- preliminaire --// // bizarre ? builderParams_.selectedLine_ = builderParams_.getSelectedLine(); @@ -172,7 +231,7 @@ final JPanel bouttonCenter = new JPanel(new FlowLayout(FlowLayout.CENTER)); bouttonCenter.add(checkboxNewGraphe_); content.add(bouttonCenter, BorderLayout.NORTH); - + content.add(traceOrigineDansVue2d_,BorderLayout.SOUTH); content.setBorder(CtuluLibSwing.createTitleBorder(CtuluLib.getS("Etape 3: S\xE9lection et cr\xE9ation des graphes"))); if (actionChoixGraphes_.listeGraphesPossibles.size() == 0 && actionChoixGraphes_.listeGraphesChoisis.size() == 0) { @@ -180,6 +239,8 @@ checkboxNewGraphe_.setEnabled(false); actionChoixGraphes_.setEnabled(false); } + + traceOrigineDansVue2d_.setSelected(true); return content; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
[Fudaa-svn-commit] SF.net SVN: fudaa:[4444]
branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/ fudaa
From: <had...@us...> - 2009-02-05 18:22:07
|
Revision: 4444 http://fudaa.svn.sourceforge.net/fudaa/?rev=4444&view=rev Author: hadouxad Date: 2009-02-05 18:21:55 +0000 (Thu, 05 Feb 2009) Log Message: ----------- - calques destructibles (trajectoires, trace de courbes, cr?\195?\169ation depuis option origine du graphe) - cr?\195?\169ation de groupes pour rangement des traces de calques - ihm grilles et sous grilles graphe: sch?\195?\169ma des vues 2d - Refactorisation des algos de calculs fixes nb graduations et longueur de pas sous forme d iterator. - Grilles et sous grilles des graphes: - mode par nombre de graduations - mode par longueur de pas - ajout des tracelignemodel pour les 2 type de trac?\195?\169s - Utilisation des bselecteurs interfaces - Grilles et sous grilles des vues 2d - ajout des traceligne model pour les 2 versions - Wizard: - Texte avec case a cocher - Case par default a false - Undo/redo op?\195?\169rationnels pour les superposition des frames. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.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/TrPostSourceComparatorBuilder.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostTrajectoireComputeAndDisplayActivity.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrReplayCurvesData.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardProfilSpatial.java Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-05 18:20:44 UTC (rev 4443) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-05 18:21:55 UTC (rev 4444) @@ -8,6 +8,7 @@ import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.beans.PropertyChangeListener; import javax.swing.JColorChooser; import javax.swing.JComponent; @@ -19,9 +20,12 @@ import org.fudaa.ebli.calque.ZEbliCalquesPanel; import org.fudaa.ebli.commun.EbliActionPaletteAbstract; import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.controle.BSelecteurLineModel; import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; +import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.ebli.trace.TraceIconButton; +import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.volume.controles.BControleVisible; import com.memoire.bu.BuButton; @@ -40,7 +44,7 @@ * @author fred deniger * @version $Id: FSigGrillePalette.java,v 1.2 2007-04-16 16:35:35 deniger Exp $ */ -public final class FSigGrillePalette extends EbliActionPaletteAbstract { +public final class FSigGrillePalette extends EbliActionPaletteAbstract implements BSelecteurTargetInterface { final ZCalqueGrille target_; @@ -66,7 +70,7 @@ return r; } - @Override + public JComponent buildContentPane() { final BuPanel content = new BuPanel(new BuVerticalLayout(2)); content.add(createMainProperties()); @@ -75,6 +79,11 @@ return content; } + public static String GRILLE_AXE_X="GRILLE_AXE_X"; + public static String GRILLE_AXE_Y="GRILLE_AXE_Y"; + public static String SOUS_GRILLE_AXE_X="SOUS_GRILLE_AXE_X"; + public static String SOUS_GRILLE_AXE_Y="SOUS_GRILLE_AXE_Y"; + private static String MANUEL1 = "MANUEL1"; private static String MANUEL2 = "MANUEL2"; private static String AUTO = "AUTO"; @@ -612,36 +621,42 @@ }); pn.add(cb); - pn.add(new BuLabel(EbliLib.getS("Couleur Grille"))); - final TraceIconButton btColor = new TraceIconButton(); - btColor.setForeground(target_.getForeground()); - btColor.addActionListener(new ActionListener() { - - public void actionPerformed(final ActionEvent _e) { - final Color c = JColorChooser.showDialog(target_, EbliLib.getS("Couleur Grille"), target_.getForeground()); - if (c != null) { - target_.setForeground(c); - btColor.setForeground(c); - } - } - }); - pn.add(btColor); - - pn.add(new BuLabel(EbliLib.getS("Couleur Sous Grille"))); - final TraceIconButton btColor2 = new TraceIconButton(); - btColor2.setForeground(target_.getForeground()); - btColor2.addActionListener(new ActionListener() { - - public void actionPerformed(final ActionEvent _e) { - final Color c = JColorChooser.showDialog(target_, EbliLib.getS("Couleur Sous Grille"), target_.getForeground()); - if (c != null) { - target_.setSousGraduationColor(c); - btColor2.setForeground(c); - } - } - }); - pn.add(btColor2); - + pn.add(new BuLabel(EbliLib.getS("Forme Grille"))); +// final TraceIconButton btColor = new TraceIconButton(); +// btColor.setForeground(target_.getForeground()); +// btColor.addActionListener(new ActionListener() { +// +// public void actionPerformed(final ActionEvent _e) { +// final Color c = JColorChooser.showDialog(target_, EbliLib.getS("Couleur Grille"), target_.getForeground()); +// if (c != null) { +// target_.setForeground(c); +// btColor.setForeground(c); +// } +// } +// }); +// pn.add(btColor); + BSelecteurLineModel modelGraduations = new BSelecteurLineModel(GRILLE_AXE_X,this.target_.getTraceGraduations_()); + modelGraduations.setSelecteurTarget(this); + pn.add(modelGraduations.buildPanel()); + + pn.add(new BuLabel(EbliLib.getS("Forme Sous Grille"))); +// final TraceIconButton btColor2 = new TraceIconButton(); +// btColor2.setForeground(target_.getForeground()); +// btColor2.addActionListener(new ActionListener() { +// +// public void actionPerformed(final ActionEvent _e) { +// final Color c = JColorChooser.showDialog(target_, EbliLib.getS("Couleur Sous Grille"), target_.getForeground()); +// if (c != null) { +// target_.setSousGraduationColor(c); +// btColor2.setForeground(c); +// } +// } +// }); +// pn.add(btColor2); + BSelecteurLineModel modelSousGraduations = new BSelecteurLineModel(SOUS_GRILLE_AXE_X,this.target_.getTraceSousGraduations_()); + modelSousGraduations.setSelecteurTarget(this); + pn.add(modelSousGraduations.buildPanel()); + pn.add(new BuLabel(EbliLib.getS("Fonte"))); final BuButton btFont = new BuButton("1234.567"); pn.add(btFont); @@ -708,4 +723,51 @@ zoom.add(btRestaurer); return zoom; } + + +public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { + // TODO Auto-generated method stub + +} + + +public Object getMin(String _key) { + // TODO Auto-generated method stub + return null; +} + + +public Object getMoy(String _key) { + // TODO Auto-generated method stub + return null; +} + + +public Object getProperty(String _key) { + if(_key.equals(GRILLE_AXE_X)) + return target_.getTraceGraduations_(); + if(_key.equals(SOUS_GRILLE_AXE_X)) + return target_.getTraceSousGraduations_(); + return null; +} + + +public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { + // TODO Auto-generated method stub + +} + + +public boolean setProperty(String _key, Object prop) { + boolean ok=false; + if(_key.equals(GRILLE_AXE_X)){ + target_.modifieTraceGraduations((TraceLigneModel) prop); + ok=true; + } + if(_key.equals(SOUS_GRILLE_AXE_X)){ + target_.modifieSousGraduations((TraceLigneModel) prop); + ok=true; + } + return ok; +} } \ No newline at end of file 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-02-05 18:20:44 UTC (rev 4443) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostProjet.java 2009-02-05 18:21:55 UTC (rev 4444) @@ -101,1408 +101,1607 @@ */ public class TrPostProjet implements ActionListener { - /** - * Manager de sauvegarder/charghement des donn\xE9es - */ - private TrPostPersistenceManager manager_; + /** + * Manager de sauvegarder/charghement des donn\xE9es + */ + private TrPostPersistenceManager manager_; - public TrPostPersistenceManager getManager() { - if (manager_ == null) manager_ = new TrPostPersistenceManager(this); + public TrPostPersistenceManager getManager() { + if (manager_ == null) + manager_ = new TrPostPersistenceManager(this); - return manager_; - } + return manager_; + } - private class TimeContentUpdater implements ListDataListener { + private class TimeContentUpdater implements ListDataListener { - protected TimeContentUpdater() { + protected TimeContentUpdater() { - } + } - protected void updateAll() { - // TODO a revoir - // if (fille_ != null && fille_.isVisible()) { - // if (CtuluLibMessage.DEBUG) { - // CtuluLibMessage.debug("update fill time format"); - // } - // final TrPostVisuPanel panel = (TrPostVisuPanel) fille_.getVisuPanel(); - // final BCalque[] cqs = panel.getDonneesCalque().getCalques(); - // for (int i = cqs.length - 1; i >= 0; i--) { - // final BCalque calque = cqs[i]; - // if (calque instanceof TrPostFlecheLayer) { - // ((TrPostFlecheLayer) calque).timeStepFormatChanged(); - // } else if (calque instanceof TrIsoLayerDefault) { - // ((TrIsoLayerDefault) calque).timeStepFormatChanged(); - // } - // } - // final TrPostFlecheLayer flecheLayer = panel.getFlecheLayer(); - // if (flecheLayer != null) { - // flecheLayer.timeStepFormatChanged(); - // } - // final TrIsoLayer liso = panel.getIsoLayer(); - // if (liso != null && liso.isVisible()) { - // liso.timeStepFormatChanged(); - // } - // if (!fille_.getArbreCalqueModel().getTreeSelectionModel().isSelectionEmpty()) { - // final TreePath[] path = fille_.getArbreCalqueModel().getTreeSelectionModel().getSelectionPaths(); - // fille_.getArbreCalqueModel().getTreeSelectionModel().clearSelection(); - // fille_.getArbreCalqueModel().getTreeSelectionModel().setSelectionPaths(path); - // } - // } - setProjectModified(); - } + protected void updateAll() { + // TODO a revoir + // if (fille_ != null && fille_.isVisible()) { + // if (CtuluLibMessage.DEBUG) { + // CtuluLibMessage.debug("update fill time format"); + // } + // final TrPostVisuPanel panel = (TrPostVisuPanel) + // fille_.getVisuPanel(); + // final BCalque[] cqs = panel.getDonneesCalque().getCalques(); + // for (int i = cqs.length - 1; i >= 0; i--) { + // final BCalque calque = cqs[i]; + // if (calque instanceof TrPostFlecheLayer) { + // ((TrPostFlecheLayer) calque).timeStepFormatChanged(); + // } else if (calque instanceof TrIsoLayerDefault) { + // ((TrIsoLayerDefault) calque).timeStepFormatChanged(); + // } + // } + // final TrPostFlecheLayer flecheLayer = panel.getFlecheLayer(); + // if (flecheLayer != null) { + // flecheLayer.timeStepFormatChanged(); + // } + // final TrIsoLayer liso = panel.getIsoLayer(); + // if (liso != null && liso.isVisible()) { + // liso.timeStepFormatChanged(); + // } + // if (!fille_.getArbreCalqueModel().getTreeSelectionModel(). + // isSelectionEmpty()) { + // final TreePath[] path = + // fille_.getArbreCalqueModel().getTreeSelectionModel + // ().getSelectionPaths(); + //fille_.getArbreCalqueModel().getTreeSelectionModel().clearSelection + // (); + // fille_.getArbreCalqueModel().getTreeSelectionModel(). + // setSelectionPaths(path); + // } + // } + setProjectModified(); + } - public void contentsChanged(final ListDataEvent _event) { - updateAll(); - } + public void contentsChanged(final ListDataEvent _event) { + updateAll(); + } - public void intervalAdded(final ListDataEvent _event) { - updateAll(); - } + public void intervalAdded(final ListDataEvent _event) { + updateAll(); + } - public void intervalRemoved(final ListDataEvent _event) { - updateAll(); - } - } + public void intervalRemoved(final ListDataEvent _event) { + updateAll(); + } + } - class ModifyObserver implements Observer { + class ModifyObserver implements Observer { - private boolean isModified_; + private boolean isModified_; - protected void clearModified() { - isModified_ = false; - updateFrameState(); - } + protected void clearModified() { + isModified_ = false; + updateFrameState(); + } - protected void updateFrameState() { - if (impl_ != null) { - impl_.setEnabledForAction("ENREGISTRER", isModified_); - impl_.setEnabledForAction("ENREGISTRERSOUS", isModified_); - changedMainFrameState(); - } - } + protected void updateFrameState() { + if (impl_ != null) { + impl_.setEnabledForAction("ENREGISTRER", isModified_); + impl_.setEnabledForAction("ENREGISTRERSOUS", isModified_); + changedMainFrameState(); + } + } - public boolean isModified() { - return isModified_; - } + public boolean isModified() { + return isModified_; + } - public void setModified() { - isModified_ = true; - updateFrameState(); - } + public void setModified() { + isModified_ = true; + updateFrameState(); + } - public void update(final Observable _o, final Object _arg) { - setModified(); - } + public void update(final Observable _o, final Object _arg) { + setModified(); + } - } + } - class VariableListener implements TrPostDataListener { + class VariableListener implements TrPostDataListener { - public void dataAdded(final boolean _isFleche) { - if (impl_ == null) { return; } - final JInternalFrame[] allFrames = impl_.getAllInternalFrames(); - if (allFrames != null) { - for (int i = allFrames.length - 1; i >= 0; i--) { - TrPostDataListener l = null; - if (allFrames[i] instanceof TrPostDataListener) { - l = (TrPostDataListener) allFrames[i]; - } else if (allFrames[i].getContentPane() instanceof TrPostDataListener) { - l = (TrPostDataListener) allFrames[i].getContentPane(); - } - if (l != null) { - l.dataAdded(_isFleche); - } - } - } - setProjectModified(); - } + public void dataAdded(final boolean _isFleche) { + if (impl_ == null) { + return; + } + final JInternalFrame[] allFrames = impl_.getAllInternalFrames(); + if (allFrames != null) { + for (int i = allFrames.length - 1; i >= 0; i--) { + TrPostDataListener l = null; + if (allFrames[i] instanceof TrPostDataListener) { + l = (TrPostDataListener) allFrames[i]; + } else if (allFrames[i].getContentPane() instanceof TrPostDataListener) { + l = (TrPostDataListener) allFrames[i].getContentPane(); + } + if (l != null) { + l.dataAdded(_isFleche); + } + } + } + setProjectModified(); + } - public void dataChanged(final H2dVariableType _old, final H2dVariableType _new, final boolean _contentChanged, - final boolean _isFleche, final Set _varDepending) { - if (impl_ == null) { return; } - final JInternalFrame[] allFrames = impl_.getAllInternalFrames(); - if (allFrames != null) { - for (int i = allFrames.length - 1; i >= 0; i--) { - TrPostDataListener l = null; - if (allFrames[i] instanceof TrPostDataListener) { - l = (TrPostDataListener) allFrames[i]; - } else if (allFrames[i].getContentPane() instanceof TrPostDataListener) { - l = (TrPostDataListener) allFrames[i].getContentPane(); - } - if (l != null) { - l.dataChanged(_old, _new, _contentChanged, _isFleche, _varDepending); - } - } - } - setProjectModified(); - } + public void dataChanged(final H2dVariableType _old, + final H2dVariableType _new, final boolean _contentChanged, + final boolean _isFleche, final Set _varDepending) { + if (impl_ == null) { + return; + } + final JInternalFrame[] allFrames = impl_.getAllInternalFrames(); + if (allFrames != null) { + for (int i = allFrames.length - 1; i >= 0; i--) { + TrPostDataListener l = null; + if (allFrames[i] instanceof TrPostDataListener) { + l = (TrPostDataListener) allFrames[i]; + } else if (allFrames[i].getContentPane() instanceof TrPostDataListener) { + l = (TrPostDataListener) allFrames[i].getContentPane(); + } + if (l != null) { + l.dataChanged(_old, _new, _contentChanged, _isFleche, + _varDepending); + } + } + } + setProjectModified(); + } - public void dataRemoved(final H2dVariableType[] _vars, final boolean _isFleche) { - if (impl_ == null) { return; } - final JInternalFrame[] allFrames = impl_.getAllInternalFrames(); - if (allFrames != null) { - for (int i = allFrames.length - 1; i >= 0; i--) { - TrPostDataListener l = null; - if (allFrames[i] instanceof TrPostDataListener) { - l = (TrPostDataListener) allFrames[i]; - } else if (allFrames[i].getContentPane() instanceof TrPostDataListener) { - l = (TrPostDataListener) allFrames[i].getContentPane(); - } - if (l != null) { - l.dataRemoved(_vars, _isFleche); - } - } - } - setProjectModified(); - } + public void dataRemoved(final H2dVariableType[] _vars, + final boolean _isFleche) { + if (impl_ == null) { + return; + } + final JInternalFrame[] allFrames = impl_.getAllInternalFrames(); + if (allFrames != null) { + for (int i = allFrames.length - 1; i >= 0; i--) { + TrPostDataListener l = null; + if (allFrames[i] instanceof TrPostDataListener) { + l = (TrPostDataListener) allFrames[i]; + } else if (allFrames[i].getContentPane() instanceof TrPostDataListener) { + l = (TrPostDataListener) allFrames[i].getContentPane(); + } + if (l != null) { + l.dataRemoved(_vars, _isFleche); + } + } + } + setProjectModified(); + } - } + } - // transient TrPostFille fille_; - // - // /** - // * Fenetre fille qui contient le layout scene. Cette fenetre remplace petit a petit fille_ - // */ - // // protected transient TrPostLayoutFille filleLayout_; - // ArrayList<TrPostLayoutFille> listeFillesLayout = new ArrayList<TrPostLayoutFille>(); + // transient TrPostFille fille_; + // + // /** + // * Fenetre fille qui contient le layout scene. Cette fenetre remplace + // petit a petit fille_ + // */ + // // protected transient TrPostLayoutFille filleLayout_; + // ArrayList<TrPostLayoutFille> listeFillesLayout = new + // ArrayList<TrPostLayoutFille>(); - /** - * liste des noeuds pour gerer le cut/copy/paste avec en + le undo/redo - */ - // liste des noeuds copies - Set<EbliNode> nodesCopyied = null; - // liste des noeuuds coupes - Set<EbliNode> nodesCutted = null; + /** + * liste des noeuds pour gerer le cut/copy/paste avec en + le undo/redo + */ + // liste des noeuds copies + Set<EbliNode> nodesCopyied = null; + // liste des noeuuds coupes + Set<EbliNode> nodesCutted = null; - /** - * internalframe qui gere les multiProjets - */ - public TrPostProjetsManagerFille filleProjetctManager_; + /** + * internalframe qui gere les multiProjets + */ + public TrPostProjetsManagerFille filleProjetctManager_; - /** - * Le menu du post qui contient tout les sous menus des projets - */ - BuMenu menuPost_; - BuMenu menuLayout_ = new BuMenu(TrResource.getS("Layout"), "LAYOUTMANAGER");; - List<BuMenu> listeMenuProjets_; + /** + * Le menu du post qui contient tout les sous menus des projets + */ + BuMenu menuPost_; + BuMenu menuLayout_ = new BuMenu(TrResource.getS("Layout"), "LAYOUTMANAGER");; + List<BuMenu> listeMenuProjets_; - List<ArrayList<BuMenuItem>> listeSousMenuProjets_; + List<ArrayList<BuMenuItem>> listeSousMenuProjets_; - /** - * Observable custom reserv\xE9 aux modifs apport\xE9es a la liste des src. - * - * @author Adrien Hadoux - */ - class observableSupport extends Observable { - @Override - public void notifyObservers() { - this.setChanged(); - super.notifyObservers(); - } + /** + * Observable custom reserv\xE9 aux modifs apport\xE9es a la liste des src. + * + * @author Adrien Hadoux + */ + class observableSupport extends Observable { + @Override + public void notifyObservers() { + this.setChanged(); + super.notifyObservers(); + } - @Override - public void notifyObservers(final Object arg) { - this.setChanged(); - super.notifyObservers(arg); - } + @Override + public void notifyObservers(final Object arg) { + this.setChanged(); + super.notifyObservers(arg); + } - } + } - private observableSupport observable; + private observableSupport observable; - public observableSupport getObservable() { - if (observable == null) observable = new observableSupport(); - return observable; - } + public observableSupport getObservable() { + if (observable == null) + observable = new observableSupport(); + return observable; + } - public void notifyObservers() { - // getObservable().setChanged(); + public void notifyObservers() { + // getObservable().setChanged(); - getObservable().notifyObservers(); + getObservable().notifyObservers(); - } + } - transient int idxFilleG_; + transient int idxFilleG_; - public transient TrPostCommonImplementation impl_; + public transient TrPostCommonImplementation impl_; - ModifyObserver modifyState_ = new ModifyObserver(); + ModifyObserver modifyState_ = new ModifyObserver(); - /** - * Donnees courantes du trpost. - */ - // transient TrPostSource src_; - /** - * liste des sources pour le multiProjet. - */ - public transient ArrayList<TrPostSource> listeSrc_ = new ArrayList<TrPostSource>(); + /** + * Donnees courantes du trpost. + */ + // transient TrPostSource src_; + /** + * liste des sources pour le multiProjet. + */ + public transient ArrayList<TrPostSource> listeSrc_ = new ArrayList<TrPostSource>(); - transient TimeContentUpdater timeUpdater_; + transient TimeContentUpdater timeUpdater_; - public TrPostProjet(final TrPostCommonImplementation _impl) { - this(null, _impl); + public TrPostProjet(final TrPostCommonImplementation _impl) { + this(null, _impl); - } + } - public TrPostProjet(final TrPostSource _src, final TrPostCommonImplementation _impl) { - if (_src != null) ajouterSource(_src); + public TrPostProjet(final TrPostSource _src, + final TrPostCommonImplementation _impl) { + if (_src != null) + ajouterSource(_src); - // -- creation de la frame de gestion multi projet --// - filleProjetctManager_ = new TrPostProjetsManagerFille(this); - impl_ = _impl; + // -- creation de la frame de gestion multi projet --// + filleProjetctManager_ = new TrPostProjetsManagerFille(this); + impl_ = _impl; - } + } - /** - * Permet d ajouter une source dans le projet afin de gerer le multi source. On doit toujorus passer par cette methode - * pour ajouter une source. - * - * @param _src - */ - public void ajouterSource(final TrPostSource _src) { - ajouterSource(_src, null); + /** + * Permet d ajouter une source dans le projet afin de gerer le multi source. + * On doit toujorus passer par cette methode pour ajouter une source. + * + * @param _src + */ + public void ajouterSource(final TrPostSource _src) { + ajouterSource(_src, null); - } + } - public void ajouterSource(final TrPostSource _src, String title) { - _src.addVariableListener(new VariableListener()); - if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { - listeSrc_.add(_src); - _src.buildDefaultVarUpdateLists(); + public void ajouterSource(final TrPostSource _src, String title) { + _src.addVariableListener(new VariableListener()); + if (_src.getFiles() == null || !isOneSourceLoaded(_src.getFiles())) { + listeSrc_.add(_src); + _src.buildDefaultVarUpdateLists(); - // -- ajout du menu correspondant uniquement a partir de la 2eme --// - // if (listeSrc_.size()>1 || (menuPost_!=null &&)) - construitMenuPostSpecifiqueSource(_src, title); + // -- ajout du menu correspondant uniquement a partir de la 2eme + // --// + // if (listeSrc_.size()>1 || (menuPost_!=null &&)) + construitMenuPostSpecifiqueSource(_src, title); - } else { - // -- messqge d erreur: le fichier est deja ouvert --// - new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), "Le fichier est deja ouvert.").activate(); + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), + impl_.getInformationsSoftware(), + "Le fichier est deja ouvert.").activate(); - } - // -- notify aux observers --// - this.notifyObservers(); + } + // -- notify aux observers --// + this.notifyObservers(); - } + } - public TrPostSource findSource(final String _file) { - return findSource(new File(_file)); - } + public TrPostSource findSource(final String _file) { + return findSource(new File(_file)); + } - /** - * retourne la source dans la liste des sources correspondant au fichier. retourne null sinon. - * - * @param _file : path absolu du fichier - * @return - */ - public TrPostSource findSource(final File _file) { + /** + * retourne la source dans la liste des sources correspondant au fichier. + * retourne null sinon. + * + * @param _file + * : path absolu du fichier + * @return + */ + public TrPostSource findSource(final File _file) { - for (final Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { - final TrPostSource src = it.next(); - if (src.isOpened(_file)) return src; - } + for (final Iterator<TrPostSource> it = listeSrc_.iterator(); it + .hasNext();) { + final TrPostSource src = it.next(); + if (src.isOpened(_file)) + return src; + } - return null; - } + return null; + } - public TrPostSource findSource(final Collection<File> _file) { + public TrPostSource findSource(final Collection<File> _file) { - for (final Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { - final TrPostSource src = it.next(); - if (isOpenedIn(_file, src)) return src; - } - return null; - } + for (final Iterator<TrPostSource> it = listeSrc_.iterator(); it + .hasNext();) { + final TrPostSource src = it.next(); + if (isOpenedIn(_file, src)) + return src; + } + return null; + } - private boolean isOpenedIn(Collection<File> files, TrPostSource _in) { - if (_in == null) return false; - boolean sourceGetAllFiles = true; - for (File file : files) { - if (!_in.isOpened(file)) sourceGetAllFiles = false;; + private boolean isOpenedIn(Collection<File> files, TrPostSource _in) { + if (_in == null) + return false; + boolean sourceGetAllFiles = true; + for (File file : files) { + if (!_in.isOpened(file)) + sourceGetAllFiles = false; + ; - } - return sourceGetAllFiles; + } + return sourceGetAllFiles; - } + } - /** - * Retourne la source asscoi\xE9 a l id. - * - * @param _id - * @return - */ - public TrPostSource findSourceById(final String _id) { + /** + * Retourne la source asscoi\xE9 a l id. + * + * @param _id + * @return + */ + public TrPostSource findSourceById(final String _id) { - for (final Iterator<TrPostSource> it = listeSrc_.iterator(); it.hasNext();) { - final TrPostSource src = it.next(); - if (src.getId().equals(_id)) return src; - } + for (final Iterator<TrPostSource> it = listeSrc_.iterator(); it + .hasNext();) { + final TrPostSource src = it.next(); + if (src.getId().equals(_id)) + return src; + } - return null; - } + return null; + } - /** - * Retourne toutes les sources qui ne sont pas des composites - * - * @return - */ - public List<TrPostSource> getAllClassicalSource() { - List<TrPostSource> res = new ArrayList<TrPostSource>(); - for (TrPostSource src : listeSrc_) { - if (!isAsuiteCalcul(src)) res.add(src); - } - return res; - } + /** + * Retourne toutes les sources qui ne sont pas des composites + * + * @return + */ + public List<TrPostSource> getAllClassicalSource() { + List<TrPostSource> res = new ArrayList<TrPostSource>(); + for (TrPostSource src : listeSrc_) { + if (!isAsuiteCalcul(src)) + res.add(src); + } + return res; + } - /** - * Retourne toutes les sources qui sont des composites - * - * @return - */ - public List<TrPostSourceFromReader> getAllCCompositeSource() { - List<TrPostSourceFromReader> res = new ArrayList<TrPostSourceFromReader>(); - for (TrPostSource src : listeSrc_) { - if (isAsuiteCalcul(src)) res.add((TrPostSourceFromReader) src); - } - return res; - } + /** + * Retourne toutes les sources qui sont des composites + * + * @return + */ + public List<TrPostSourceFromReader> getAllCCompositeSource() { + List<TrPostSourceFromReader> res = new ArrayList<TrPostSourceFromReader>(); + for (TrPostSource src : listeSrc_) { + if (isAsuiteCalcul(src)) + res.add((TrPostSourceFromReader) src); + } + return res; + } - public boolean isSourceLoaded(final String _file) { - return isSourceLoaded(new File(_file)); - } + public boolean isSourceLoaded(final String _file) { + return isSourceLoaded(new File(_file)); + } - /** - * indique si il existe une source portant le nom du fichier en param. - * - * @param _file : path absolu du fichier - * @return - */ - public boolean isSourceLoaded(final File _file) { - if (findSource(_file) == null) return false; - return true; - } + /** + * indique si il existe une source portant le nom du fichier en param. + * + * @param _file + * : path absolu du fichier + * @return + */ + public boolean isSourceLoaded(final File _file) { + if (findSource(_file) == null) + return false; + return true; + } - public boolean isOneSourceLoaded(final Collection<File> _files) { - if (findSource(_files) == null) return false; - return true; - } + public boolean isOneSourceLoaded(final Collection<File> _files) { + if (findSource(_files) == null) + return false; + return true; + } - // /** - // * methode qui change la source courante et retourne true si la source existe bien, false sinon - // * - // * @param _file : path absolu du fichier - // * @return - // */ - // public boolean changeSource(final TrPostSource _src) { - // - // src_ = _src; - // - // return true; - // } + // /** + // * methode qui change la source courante et retourne true si la source + // existe bien, false sinon + // * + // * @param _file : path absolu du fichier + // * @return + // */ + // public boolean changeSource(final TrPostSource _src) { + // + // src_ = _src; + // + // return true; + // } - /** - * Methode de suppression de la source - * - * @param src : TrPostSource, retourne true si la suppression a bien ete effectuee. - */ - public boolean removeSource(final TrPostSource src, final int n) { + /** + * Methode de suppression de la source + * + * @param src + * : TrPostSource, retourne true si la suppression a bien ete + * effectuee. + */ + public boolean removeSource(final TrPostSource src, final int n) { - if (isOneSourceLoaded(src.getFiles())) { - listeSrc_.remove(src); + if (isOneSourceLoaded(src.getFiles())) { + listeSrc_.remove(src); - // --recuperation du menu simul --// - final BuMenu menuSimul = getlisteMenuProjets_().get(n); + // --recuperation du menu simul --// + final BuMenu menuSimul = getlisteMenuProjets_().get(n); - // --on retire les menus correspondants --// - // for (int i = 0; i < listeSousMenuProjets_.get(n).size(); i++) { - // BuMenuItem item = listeSousMenuProjets_.get(n).get(i); - // menuSimul.remove(item); - // } + // --on retire les menus correspondants --// + // for (int i = 0; i < listeSousMenuProjets_.get(n).size(); i++) { + // BuMenuItem item = listeSousMenuProjets_.get(n).get(i); + // menuSimul.remove(item); + // } - // -- on retire le menuSimul de la liste --// - menuPost_.remove(menuSimul); + // -- on retire le menuSimul de la liste --// + menuPost_.remove(menuSimul); - // -- on retire de la liste des menus le menusimul et la liste des sous - // menus --// - getlisteMenuProjets_().remove(n); - getlisteSousMenuProjets_().remove(n); + // -- on retire de la liste des menus le menusimul et la liste des + // sous + // menus --// + getlisteMenuProjets_().remove(n); + getlisteSousMenuProjets_().remove(n); - // -- mise a jour de la barre des menus --// - impl_.getMainMenuBar().revalidate(); + // -- mise a jour de la barre des menus --// + impl_.getMainMenuBar().revalidate(); - // -- on met a jour la scene en enlevant tous les objets reli\xE9s \xE0 cette source --// - for (TrPostLayoutFille frame : impl_.getAllLayoutFille()) { - frame.getScene().removeAllWidgetLinkedToSrc(src); - } + // -- on met a jour la scene en enlevant tous les objets reli\xE9s \xE0 + // cette source --// + for (TrPostLayoutFille frame : impl_.getAllLayoutFille()) { + frame.getScene().removeAllWidgetLinkedToSrc(src); + } - return true; - } else { - // -- messqge d erreur: le fichier est deja ouvert --// - new BuDialogMessage(impl_.getApp(), impl_.getInformationsSoftware(), - "Impossible de supprimer ce fichier de la liste.").activate(); + return true; + } else { + // -- messqge d erreur: le fichier est deja ouvert --// + new BuDialogMessage(impl_.getApp(), + impl_.getInformationsSoftware(), + "Impossible de supprimer ce fichier de la liste.") + .activate(); - return false; - } + return false; + } - } + } - /** - * methode qui formatte les infos de la source - * - * @param _src - * @return - */ - public String formatInfoSource(final TrPostSource _src) { - // --ajout dans la liste des titres --// - Collection<File> files = _src.getFiles(); - if (!isAsuiteCalcul(_src)) return formatName(_src.getTitle()) + " | Fichier: " - + formatFichier(files.iterator().next()); - else { + /** + * methode qui formatte les infos de la source + * + * @param _src + * @return + */ + public String formatInfoSource(final TrPostSource _src) { + // --ajout dans la liste des titres --// + Collection<File> files = _src.getFiles(); + if (!isAsuiteCalcul(_src)) + return formatName(_src.getTitle()) + " | Fichier: " + + formatFichier(files.iterator().next()); + else { - // String listeFiles=""; - // for(File f:files) - // listeFiles+="| "+f.getName(); - return _src.getTitle();// + listeFiles; - } - } + // String listeFiles=""; + // for(File f:files) + // listeFiles+="| "+f.getName(); + return _src.getTitle();// + listeFiles; + } + } - public boolean isAsuiteCalcul(final TrPostSource _src) { - if (_src instanceof TrPostSourceFromReader) { - TrPostSourceFromReader s = (TrPostSourceFromReader) _src; - if (s.getReader() instanceof TrPostSourceReaderComposite) return true; + public boolean isAsuiteCalcul(final TrPostSource _src) { + if (_src instanceof TrPostSourceFromReader) { + TrPostSourceFromReader s = (TrPostSourceFromReader) _src; + if (s.getReader() instanceof TrPostSourceReaderComposite) + return true; - } + } - return false; - } + return false; + } - public String formatFichier(final File file) { - if (file == null) return ""; - final String nomFichier = file.getAbsolutePath(); - // int position = nomFichier.lastIndexOf(File.separator) + 1; - // if (position != -1) { - // nomFichier = nomFichier.substring(position); - // } - // position = nomFichier.lastIndexOf(CtuluLibString.DOT); - // if (position != -1) { - // nomFichier = nomFichier.substring(0, position); - // } - // FuLog.warning("nom du fichier: " + nomFichier); - return nomFichier; - } + public String formatFichier(final File file) { + if (file == null) + return ""; + final String nomFichier = file.getAbsolutePath(); + // int position = nomFichier.lastIndexOf(File.separator) + 1; + // if (position != -1) { + // nomFichier = nomFichier.substring(position); + // } + // position = nomFichier.lastIndexOf(CtuluLibString.DOT); + // if (position != -1) { + // nomFichier = nomFichier.substring(0, position); + // } + // FuLog.warning("nom du fichier: " + nomFichier); + return nomFichier; + } - /** - * formatte le titre - * - * @param file - * @return - */ - public String formatName(String title) { - // --suppression des trop long espaces du titre --// + /** + * formatte le titre + * + * @param file + * @return + */ + public String formatName(String title) { + // --suppression des trop long espaces du titre --// - title = title.replaceAll(" ", ""); + title = title.replaceAll(" ", ""); - return title; - } + return title; + } - /** - * Construit un menu specifique a la source choisie. A chaque fois que l on ajoute une source au projet, il faut - * ajouter un menu sp\xE9cifique. - * - * @param _src - */ - public void construitMenuPostSpecifiqueSource(final TrPostSource _src, String title) { + /** + * Construit un menu specifique a la source choisie. A chaque fois que l on + * ajoute une source au projet, il faut ajouter un menu sp\xE9cifique. + * + * @param _src + */ + public void construitMenuPostSpecifiqueSource(final TrPostSource _src, + String title) { - BuMenu menuSimul = null; - if (title == null) menuSimul = new BuMenu((listeSrc_.size()) + ". " - + formatFichier(_src.getFiles().iterator().next()), "SIMULATION" + (listeSrc_.size())); - else menuSimul = new BuMenu((listeSrc_.size()) + ". " + _src.getTitle(), "SIMULATION" + (listeSrc_.size())); - // -- ajout du menu au menu post --// - getMenuPost().add(menuSimul); + BuMenu menuSimul = null; + if (title == null) + menuSimul = new BuMenu((listeSrc_.size()) + ". " + + formatFichier(_src.getFiles().iterator().next()), + "SIMULATION" + (listeSrc_.size())); + else + menuSimul = new BuMenu((listeSrc_.size()) + ". " + _src.getTitle(), + "SIMULATION" + (listeSrc_.size())); + // -- ajout du menu au menu post --// + getMenuPost().add(menuSimul); - // -- sauvegarde d une trace du menu dans la liste pour une suppression - // ulterieure --// - getlisteMenuProjets_().add(menuSimul); + // -- sauvegarde d une trace du menu dans la liste pour une suppression + // ulterieure --// + getlisteMenuProjets_().add(menuSimul); -// final ArrayList<BuMenuItem> listSousMenus = new ArrayList<BuMenuItem>(); -// -// final BuIcon ic = BuResource.BU.getIcon("aucun"); -// -// listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Extrema..."), "COMPUTE_EXTREMA", ic, TrPostProjet.this)); -// listSousMenus.add(menuSimul.addMenuItem(CtuluLib.getS("Editer les variables..."), "VARIABLES", ic, -// TrPostProjet.this)); -// menuSimul.addSeparator(); -// listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Palettes de couleurs"), "PALETTE_DEFAULT", ic, -// TrPostProjet.this)); -// listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Formater/modifier les pas de temps..."), "TIME_FORMAT", -// ic, TrPostProjet.this)); -// -// menuSimul.addSeparator(); -// -// listSousMenus.add(menuSimul.addMenuItem(new TrPostBuilderSuiteCalcul.ActionBuildSuite(_src, TrResource -// .getS("Suite de calcul"), EbliResource.EBLI.getIcon(""), "SUITECALCUL", impl_))); -// listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Comparer..."), "COMPARE", ic, TrPostProjet.this)); -// listSousMenus.get(listSousMenus.size() - 1).setToolTipText( -// TrResource.getS("Comparer les r\xE9sultats avec ceux d'un autre projet")); -// listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Projeter..."), "PROJECT", ic, TrPostProjet.this)); -// listSousMenus.get(listSousMenus.size() - 1).setToolTipText( -// TrResource.getS("Projeter les r\xE9sultats sur un maillage diff\xE9rent")); -// -// menuSimul.addSeparator(); -// -// listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Exporter"), "EXPORTDATA", TrPostProjet.this)); -// _src.addSpecificItemInMainMenu(menuSimul, getImpl()); + // final ArrayList<BuMenuItem> listSousMenus = new + // ArrayList<BuMenuItem>(); + // + // final BuIcon ic = BuResource.BU.getIcon("aucun"); + // + //listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Extrema..."), + // "COMPUTE_EXTREMA", ic, TrPostProjet.this)); + // listSousMenus.add(menuSimul.addMenuItem(CtuluLib.getS( + // "Editer les variables..."), "VARIABLES", ic, + // TrPostProjet.this)); + // menuSimul.addSeparator(); + // listSousMenus.add(menuSimul.addMenuItem(TrResource.getS( + // "Palettes de couleurs"), "PALETTE_DEFAULT", ic, + // TrPostProjet.this)); + // listSousMenus.add(menuSimul.addMenuItem(TrResource.getS( + // "Formater/modifier les pas de temps..."), "TIME_FORMAT", + // ic, TrPostProjet.this)); + // + // menuSimul.addSeparator(); + // + // listSousMenus.add(menuSimul.addMenuItem(new + // TrPostBuilderSuiteCalcul.ActionBuildSuite(_src, TrResource + // .getS("Suite de calcul"), EbliResource.EBLI.getIcon(""), + // "SUITECALCUL", impl_))); + //listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Comparer...") + // , "COMPARE", ic, TrPostProjet.this)); + // listSousMenus.get(listSousMenus.size() - 1).setToolTipText( + //TrResource.getS("Comparer les r\xE9sultats avec ceux d'un autre projet")) + // ; + //listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Projeter...") + // , "PROJECT", ic, TrPostProjet.this)); + // listSousMenus.get(listSousMenus.size() - 1).setToolTipText( + // TrResource.getS("Projeter les r\xE9sultats sur un maillage diff\xE9rent")); + // + // menuSimul.addSeparator(); + // + // listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Exporter"), + // "EXPORTDATA", TrPostProjet.this)); + // _src.addSpecificItemInMainMenu(menuSimul, getImpl()); - ArrayList<BuMenuItem>listSousMenus= getSousMenusSpecifiqueSource(_src, menuSimul); - // -- ajout de la sous liste de menus pour la garder en memoire --// - getlisteSousMenuProjets_().add(listSousMenus); + ArrayList<BuMenuItem> listSousMenus = getSousMenusSpecifiqueSource( + _src, menuSimul); + // -- ajout de la sous liste de menus pour la garder en memoire --// + getlisteSousMenuProjets_().add(listSousMenus); - - } - - /** - * Cree la liste des menu items sp\xE9cifiques au fichier source charg\xE9. - * @param _src - * @param menuSimul - * @return - */ - public ArrayList<BuMenuItem> getSousMenusSpecifiqueSource(final TrPostSource _src,BuMenu menuSimul ){ - final ArrayList<BuMenuItem> listSousMenus = new ArrayList<BuMenuItem>(); + } - final BuIcon ic = BuResource.BU.getIcon("aucun"); + /** + * Cree la liste des menu items sp\xE9cifiques au fichier source charg\xE9. + * + * @param _src + * @param menuSimul + * @return + */ + public ArrayList<BuMenuItem> getSousMenusSpecifiqueSource( + final TrPostSource _src, BuMenu menuSimul) { + final ArrayList<BuMenuItem> listSousMenus = new ArrayList<BuMenuItem>(); - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Extrema..."), "COMPUTE_EXTREMA", ic, TrPostProjet.this)); - BuMenuItem item=new BuMenuItem(); - - listSousMenus.add(menuSimul.addMenuItem(CtuluLib.getS("Editer les variables..."), "VARIABLES", ic, - TrPostProjet.this)); - menuSimul.addSeparator(); - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Palettes de couleurs"), "PALETTE_DEFAULT", ic, - TrPostProjet.this)); - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Formater/modifier les pas de temps..."), "TIME_FORMAT", - ic, TrPostProjet.this)); + final BuIcon ic = BuResource.BU.getIcon("aucun"); - menuSimul.addSeparator(); + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Extrema..."), + "COMPUTE_EXTREMA", ic, TrPostProjet.this)); + BuMenuItem item = new BuMenuItem(); - listSousMenus.add(menuSimul.addMenuItem(new TrPostBuilderSuiteCalcul.ActionBuildSuite(_src, TrResource - .getS("Suite de calcul"), EbliResource.EBLI.getIcon(""), "SUITECALCUL", impl_))); - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Comparer..."), "COMPARE", ic, TrPostProjet.this)); - listSousMenus.get(listSousMenus.size() - 1).setToolTipText( - TrResource.getS("Comparer les r\xE9sultats avec ceux d'un autre projet")); - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Projeter..."), "PROJECT", ic, TrPostProjet.this)); - listSousMenus.get(listSousMenus.size() - 1).setToolTipText( - TrResource.getS("Projeter les r\xE9sultats sur un maillage diff\xE9rent")); + listSousMenus.add(menuSimul.addMenuItem(CtuluLib + .getS("Editer les variables..."), "VARIABLES", ic, + TrPostProjet.this)); + menuSimul.addSeparator(); + listSousMenus.add(menuSimul.addMenuItem(TrResource + .getS("Palettes de couleurs"), "PALETTE_DEFAULT", ic, + TrPostProjet.this)); + listSousMenus.add(menuSimul.addMenuItem(TrResource + .getS("Formater/modifier les pas de temps..."), "TIME_FORMAT", + ic, TrPostProjet.this)); - menuSimul.addSeparator(); - - listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Exporter"), "EXPORTDATA", TrPostProjet.this)); - _src.addSpecificItemInMainMenu(menuSimul, getImpl()); - return listSousMenus; - } - + menuSimul.addSeparator(); - public BuMenu getMenuPost() { - if (menuPost_ == null) menuPost_ = new BuMenu(TrResource.getS("Post"), "POST"); - return menuPost_; - } + listSousMenus.add(menuSimul + .addMenuItem(new TrPostBuilderSuiteCalcul.ActionBuildSuite( + _src, TrResource.getS("Suite de calcul"), + EbliResource.EBLI.getIcon(""), "SUITECALCUL", impl_))); + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Comparer..."), + "COMPARE", ic, TrPostProjet.this)); + listSousMenus + .get(listSousMenus.size() - 1) + .setToolTipText( + TrResource + .getS("Comparer les r\xE9sultats avec ceux d'un autre projet")); + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Projeter..."), + "PROJECT", ic, TrPostProjet.this)); + listSousMenus + .get(listSousMenus.size() - 1) + .setToolTipText( + TrResource + .getS("Projeter les r\xE9sultats sur un maillage diff\xE9rent")); - /** - * Creation par defaut du menu post de l interface. Cette methdoe est appelee une seule dfois au moment de la creation - * de l impl. - */ - public void setMenuPost() { - final BuMenuBar menubar = impl_.getMainMenuBar(); + menuSimul.addSeparator(); - Component comp = null; - if (getMenuPost().getMenuComponentCount() > 0) { - comp = getMenuPost().getMenuComponent(0); - // getMenuPost().remove(0); - } + listSousMenus.add(menuSimul.addMenuItem(TrResource.getS("Exporter"), + "EXPORTDATA", TrPostProjet.this)); + _src.addSpecificItemInMainMenu(menuSimul, getImpl()); + return listSousMenus; + } - getMenuPost().setIcon(null); - getMenuPost().setName("mnPost"); + public BuMenu getMenuPost() { + if (menuPost_ == null) + menuPost_ = new BuMenu(TrResource.getS("Post"), "POST"); + return menuPost_; + } - menubar.add(getMenuPost(), 2); + /** + * Creation par defaut du menu post de l interface. Cette methdoe est + * appelee une seule dfois au moment de la creation de l impl. + */ + public void setMenuPost() { + final BuMenuBar menubar = impl_.getMainMenuBar(); - getMenuPost().addSeparator(TrResource.getS("Layout")); - // -- ajout de l action de creation du calque --// - // getMenuPost().add(new TrPostActionChooseAndCreateCalque(this)); - // getMenuPost().addMenuItem(TrResource.getS("Vue 2D"), "VIEW_2D", BuResource.BU.getIcon("aucun"), TrPostProjet.this); - getMenuPost().addMenuItem(TrResource.getS(("Ajouter une nouvelle fen\xEAtre")), "AJOUTFRAME", - CtuluResource.CTULU.getIcon("crystal_ajouter"), new ActionListener() { + Component comp = null; + if (getMenuPost().getMenuComponentCount() > 0) { + comp = getMenuPost().getMenuComponent(0); + // getMenuPost().remove(0); + } - public void actionPerformed(final ActionEvent _e) { - createNewLayoutFrame(); + getMenuPost().setIcon(null); + getMenuPost().setName("mnPost"); - } - }); - getMenuPost().addMenuItem(TrResource.getS(("Fusionner avec un autre projet POST")), "FUSIONPOST", - CtuluResource.CTULU.getIcon("crystal_ajouter"), new ActionListener() { + menubar.add(getMenuPost(), 2); - public void actionPerformed(final ActionEvent _e) { - boolean ok = CtuluLibDialog - .showConfirmation( - getImpl().getFrame(), - TrResource.getS("Fusionner avec un autre projet POST"), - TrResource - .getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?"), - TrResource.getS("Sauvegarder et continuer"), TrResource.getS("Annuler")); - if (!ok) return; - getManager().saveProject(false); - getManager().loadProject(false, null); - // -- on reinitialise le nom path du projet a null pour qu'il soit redemand\xE9 lors de la nouvelle sauvegarde - // --// - getManager().setProjet(null); + getMenuPost().addSeparator(TrResource.getS("Layout")); + // -- ajout de l action de creation du calque --// + // getMenuPost().add(new TrPostActionChooseAndCreateCalque(this)); + // getMenuPost().addMenuItem(TrResource.getS("Vue 2D"), "VIEW_2D", + // BuResource.BU.getIcon("aucun"), TrPostProjet.this); + getMenuPost().addMenuItem( + TrResource.getS(("Ajouter une nouvelle fen\xEAtre")), + "AJOUTFRAME", CtuluResource.CTULU.getIcon("crystal_ajouter"), + new ActionListener() { - } - }); + public void actionPerformed(final ActionEvent _e) { + createNewLayoutFrame(); - getMenuPost().addSeparator(TrResource.getS("Gestion")); - // -- ajout de l action de gestion des simus dans post --// - final BuMenuItem item = new BuMenuItem(TrResource.getS("Gestion Multi-Sources")); - item.addActionListener(new ActionListener() { + } + }); + getMenuPost().addMenuItem( + TrResource.getS(("Fusionner avec un autre projet POST")), + "FUSIONPOST", CtuluResource.CTULU.getIcon("crystal_ajouter"), + new ActionListener() { - public void actionPerformed(final ActionEvent e) { - // -- affichage de la fenetre de gestion multi projet --// + public void actionPerformed(final ActionEvent _e) { + boolean ok = CtuluLibDialog + .showConfirmation( + getImpl().getFrame(), + TrResource + .getS("Fusionner avec un autre projet POST"), + TrResource + .getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?"), + TrResource + .getS("Sauvegarder et continuer"), + TrResource.getS("Annuler")); + if (!ok) + return; + getManager().saveProject(false); + getManager().loadProject(false, null); + // -- on reinitialise le nom path du projet a null pour + // qu'il soit redemand\xE9 lors de la nouvelle sauvegarde + // --// + getManager().setProjet(null); - if (!filleProjetctManager_.isVisible()) { -// filleProjetctManager_.setSize(filleProjetctManager_.getSize().width, -// filleProjetctManager_.getSize().height / 2); + } + }); - impl_.addInternalFrame(filleProjetctManager_); - } else filleProjetctManager_.moveToFront(); + getMenuPost().addSeparator(TrResource.getS("Gestion")); + // -- ajout de l action de gestion des simus dans post --// + final BuMenuItem item = new BuMenuItem(TrResource + .getS("Gestion Multi-Sources")); + item.addActionListener(new ActionListener() { - } + public void actionPerformed(final ActionEvent e) { + // -- affichage de la fenetre de gestion multi projet --// - }); - getMenuPost().add(item); - getMenuPost().addSeparator("Liste des Fichiers r\xE9sultats"); - // -- init de la liste des menus --// + if (!filleProjetctManager_.isVisible()) { + //filleProjetctManager_.setSize(filleProjetctManager_.getSize + // ().width, + // filleProjetctManager_.getSize().height / 2); - // -- construction par defaut du premier menu de simulation --// - // construitMenuPostSpecifiqueSource(getSource(0)); + impl_.addInternalFrame(filleProjetctManager_); + } else + filleProjetctManager_.moveToFront(); - if (comp != null) { - getMenuPost().add(comp); - } + } - } + }); + getMenuPost().add(item); + getMenuPost().addSeparator("Liste des Fichiers r\xE9sultats"); + // -- init de la liste des menus --// - public List<BuMenu> getlisteMenuProjets_() { - if (listeMenuProjets_ == null) listeMenuProjets_ = new ArrayList<BuMenu>(); - return listeMenuProjets_; - } + // -- construction par defaut du premier menu de simulation --// + // construitMenuPostSpecifiqueSource(getSource(0)); - public List<ArrayList<BuMenuItem>> getlisteSousMenuProjets_() { - if (listeSousMenuProjets_ == null) listeSousMenuProjets_ = new ArrayList<ArrayList<BuMenuItem>>(); - return listeSousMenuProjets_; - } + if (comp != null) { + getMenuPost().add(comp); + } - /** - * calcul les extrema en fonction de la source proposee - * - * @param indiceSource_ - */ - private void showExtremum(final int indiceSource_) { - final JTable table = TrPostMinMaxTableModel.createTableFor(getSource(indiceSource_)); - final TrPostMinMaxTableModel model = (TrPostMinMaxTableModel) table.getModel(); - final CtuluDialogPanel panel = new CtuluDialogPanel(); - final CtuluDialog dial = new CtuluDialog(getImpl().getFrame(), panel); - final BuButton btCalcul = new BuButton(TrResource.getS("Calcul des extrema")); - dial.setTitle(btCalcul.getText()); - btCalcul.setActionCommand("EXTREMUM"); - panel.setLayout(new BuHorizontalLayout(3, false, false)); - final BuPanel center = new BuPanel(); - center.setLayout(new BuBorderLayout(2, 2, true, true)); - final BuScrollPane scroll = new BuScrollPane(table); - scroll.setPreferredHeight((int) (table.getPreferredSize().height * 1.3)); - center.add(scroll, BuBorderLayout.CENTER); - center.add(model.createInfoPanel(table), BuBorderLayout.SOUTH); - panel.add(center); - btCalcul.setAlignmentX(1f); - btCalcul.setAlignmentY(0f); - panel.add(btCalcul); + } - btCalcul.addActionListener(new ActionListener() { + public List<BuMenu> getlisteMenuProjets_() { + if (listeMenuProjets_ == null) + listeMenuProjets_ = new ArrayList<BuMenu>(); + return listeMenuProjets_; + } - public void actionPerformed(final ActionEvent _event) { - final BuGlassPaneStop stop = new BuGlassPaneStop(); - dial.setGlassPane(stop); - stop.setVisible(true); - new CtuluTaskOperationGUI(impl_, CtuluLibString.EMPTY_STRING) { + public List<ArrayList<BuMenuItem>> getlisteSousMenuProjets_() { + if (listeSousMenuProjets_ == null) + listeSousMenuProjets_ = new ArrayList<ArrayList<BuMenuItem>>(); + return listeSousMenuProjets_; + } - @Override - public void act() { - model.apply(new ProgressionBuAdapter(this), impl_); - BuLib.invokeLater(new Runnable() { - public void run() { - TrPostProjet.this.setProjectModified(); - stop.setVisible(false); - dial.getRootPane().remove(stop); - } + /** + * calcul les extrema en fonction de la source proposee + * + * @param indiceSource_ + */ + private void showExtremum(final int indiceSource_) { + final JTable table = TrPostMinMaxTableModel + .createTableFor(getSource(indiceSource_)); + final TrPostMinMaxTableModel model = (TrPostMinMaxTableModel) table + .getModel(); + final CtuluDialogPanel panel = new CtuluDialogPanel(); + final CtuluDialog dial = new CtuluDialog(getImpl().getFrame(), panel); + final BuButton btCalcul = new BuButton(TrResource + .getS("Calcul des extrema")); + dial.setTitle(btCalcul.getText()); + btCalcul.setActionCommand("EXTREMUM"); + panel.setLayout(new BuHorizontalLayout(3, false, false)); + final BuPanel center = new BuPanel(); + center.setLayout(new BuBorderLayout(2, 2, true, true)); + final BuScrollPane scroll = new BuScrollPane(table); + scroll + .setPreferredHeight((int) (table.getPreferredSize().height * 1.3)); + center.add(scroll, BuBorderLayout.CENTER); + center.add(model.createInfoPanel(table), BuBorderLayout.SOUTH); + panel.add(center); + btCalcul.setAlignmentX(1f); + btCalcul.setAlignmentY(0f); + panel.add(btCalcul); - }); - } - }.start(); - } - }); - dial.afficheDialogModal(); - } + btCalcul.addActionListener(new ActionListener() { - private void updatePaletteMin(final TrPostSource _src) { - final TrPostMinPaletteTableModel model = _src.getMinPaletteModel(); - final BuTable table = new BuTable(model); - final CtuluDialogPanel pnDial = new CtuluDialogPanel() { + public void actionPerformed(final ActionEvent _event) { + final BuGlassPaneStop stop = new BuGlassPaneStop(); + dial.setGlassPane(stop); + stop.setVisible(true); + new CtuluTaskOperationGUI(impl_, CtuluLibString.EMPTY_STRING) { - @Override - public void apply() { - if (table.isEditing()) { - table.getCellEditor().stopCellEditing(); - } - model.apply(); - } - }; + @Override + public void act() { + model.apply(new ProgressionBuAdapter(this), impl_); + BuLib.invokeLater(new Runnable() { + public void run() { + TrPostProjet.this.setProjectModified(); + stop.setVisible(false); + dial.getRootPane().remove(stop); + } - final TableColumn col0 = table.getColumnModel().getColumn(0); - col0.setMaxWidth(20); - col0.setCellRenderer(new CtuluCellBooleanRenderer()); - pnDial.setLayout(new BuVerticalLayout(2, true, true)); - pnDial.addLabel(TrResource - .getS("Activer et pr\xE9ciser les valeurs minimales \xE0 utiliser par d\xE9faut pour les palettes")); - pnDial.add(new BuScrollPane(table)); - pnDial.afficheModale(impl_.getFrame(), TrResource.getS("Valeurs par d\xE9faut pour les palettes")); + }); + } + }.start(); + } + }); + dial.afficheDialogModal(); + } - } + private void updatePaletteMin(final TrPostSource _src) { + final TrPostMinPaletteTableModel model = _src.getMinPaletteModel(); + final BuTable table = new BuTable(model); + final CtuluDialogPanel pnDial = new CtuluDialogPanel() { - // TrPostInspectorReader createWatcher(final TrPostSource _src) { - // return _src.createWatcher(this, true); - // } + @Override + public void apply() { + if (table.isEditing()) { + table.getCellEditor().stopCellEditing(); + } + model.apply(); + } + }; - boolean openSrcDataAndIsModified(final CtuluUI _ui, final ProgressionInterface _prog) { - return new TrPostProjetSaver(this).openSrcDataAndIsModified(_ui, _prog); - } + final TableColumn col0 = table.getColumnModel().getColumn(0); + col0.setMaxWidth(20); + col0.setCellRenderer(new CtuluCellBooleanRenderer()); + pnDial.setLayout(new BuVerticalLayout(2, true, true)); + pnDial + .addLabel(TrResource + .getS("Activer et pr\xE9ciser les valeurs minimales \xE0 utiliser par d\xE9faut pour les palettes")); + pnDial.add(new BuScrollPane(table)); + pnDia... [truncated message content] |