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] |