From: <had...@us...> - 2008-10-03 15:33:15
|
Revision: 4031 http://fudaa.svn.sourceforge.net/fudaa/?rev=4031&view=rev Author: hadouxad Date: 2008-10-03 15:32:59 +0000 (Fri, 03 Oct 2008) Log Message: ----------- 1) Cr?\195?\169ation de toutes les ihm d'import scop et des algos de cr?\195?\169ation des evolutionRegulieres. Il ne manque plus que tu cr?\195?\169er et donne le bon target en entr?\195?\169e et le tour est jou?\195?\169! 2)D?\195?\169but d'algorithme sur les lignes de courant, il manque des choses car je n'ai pas saisi toutes les nuances je pense Uniformisation des points sur le segment saisi. 3)Cr?\195?\169ation de l'interface et de l'action qui lance le calcul des lignes de courant, a peaufiner, notamment pour la saisie des points. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuPreferences.java branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 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/FudaaWriterScopeGENE.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/common/tr_en.fr_txt 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 Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/lib/substance.jar branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/GraphePersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeLigneCourantTrajectoire.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogLigneCourants.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeCurrentLine.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCurrentLine.java Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/substance.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuPreferences.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuPreferences.java 2008-10-03 15:29:59 UTC (rev 4030) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/BuPreferences.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -26,12 +26,17 @@ import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.LookAndFeel; +import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.plaf.ColorUIResource; import javax.swing.plaf.FontUIResource; import javax.swing.plaf.IconUIResource; import javax.swing.plaf.metal.MetalTheme; +import org.jvnet.substance.skin.SubstanceRavenGraphiteLookAndFeel; + + + import com.memoire.fu.FuFactoryInteger; import com.memoire.fu.FuLib; import com.memoire.fu.FuLog; @@ -110,6 +115,19 @@ else if (lnfname.equals("ASPECT_GTK")) lnfclass = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; else if (lnfname.equals("ASPECT_KUNSTSTOFF")) lnfclass = "com.incors.plaf.kunststoff.KunststoffLookAndFeel"; else if (lnfname.equals("ASPECT_LIQUID")) lnfclass = "com.birosoft.liquid.LiquidLookAndFeel"; +// else if (lnfname.equals("ASPECT_SUBSTANCE")){ +// lnfclass = "org.jvnet.substance.skin.SubstanceBusinessLookAndFeel"; +// +// try { +// UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceBusinessLookAndFeel"); +// forced = false; +// } catch (Exception ex) { +// FuLog.error("BPR: could not set substance theme", ex); +// } +// +// +// } + else if (lnfname.equals("ASPECT_MAC")) { FuLib.setSystemProperty("os.name", "Mac OS"); lnfclass = "com.sun.java.swing.plaf.mac.MacLookAndFeel"; Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2008-10-03 15:29:59 UTC (rev 4030) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/telemac/io/ScopeStructure.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -402,6 +402,13 @@ } + public int getVariablePosition(String nomVar){ + for(int i=0;i<getNbVariables();i++) + if(getVariable(i).equals(nomVar)) + return i; + return -1; + } + public void addValueForVariableAtSeparator(double value, int indexVariable, String nameSeparator) { ArrayList<Double> listeValueOfVar = getListValueForVariableForSeparator(nameSeparator, indexVariable); // if (listeValueOfVar == null) @@ -436,6 +443,9 @@ ArrayList<Double> listeValueOfVar = getListValueForVariableForSeparator(separator, i); if (i != 0) ligneBrochette += " "; + if(listeValueOfVar.size()<=indiceValue) + ligneBrochette += KEY.SYMBOL_VALUE_UNDEFINED; + else if (listeValueOfVar.get(indiceValue) != KEY.VALUE_UNDEFINED) ligneBrochette += listeValueOfVar.get(indiceValue); else Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/GraphePersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/GraphePersist.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/GraphePersist.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -0,0 +1,13 @@ +package org.fudaa.ebli.courbe; + + +/** + * Classe qui r\xE9cup\xE8re les donn\xE9es courbes d'un graphe et enregistre les parametres + * @author Adrien Hadoux + * + */ +public class GraphePersist { + + + +} 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-03 15:29:59 UTC (rev 4030) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -21,6 +21,7 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.ListSelectionModel; import javax.swing.filechooser.FileFilter; @@ -388,12 +389,32 @@ } /** + * donne la description du fonctionnement de l'import gene specifique + * @return + */ + public String getDescriptionImportGENE(){ + switch(comBoChoixTypeGraphe_.getSelectedIndex()){ + case 0: return "<html><body>"+TrResource.getS("S\xE9lectionnez des couples variable/valeurs num\xE9riques de s\xE9parateur. <br /> Cliquez sur ajouter pour le prendre en compte. On peut ajouter plusieurs couples.<br /> Chaque couple g\xE9n\xE9rera une courbe en prenant les valeurs num\xE9riques du s\xE9parateur choisi.")+"</body></html> "; + case 1: return "<html><body>"+TrResource.getS("S\xE9lectionner toutes les variables voulues ainsi q'une plage de d\xE9part et une plage de fin.<br /> Cela g\xE9n\xE9rera une courbe par variables. Chaque courbe prendra pour Y une interpolation par rapport au x choisi. <br />Il y aura donc autant de couples (x,y) que de s\xE9parateurs dans l'intervalle d\xE9but/fin choisi.")+"</body></html> "; + case 2: return TrResource.getS("S\xE9lectionner une variable et une plage de valeur num\xE9rique pour repr\xE9senter les valeurs de X. Idem pour Y."); + + } + return ""; + + } + + /** * Creation du panel scopGene pour choisir ses parametres * @return */ JPanel buildPanelScopeGENE(){ + final JPanel content2=new JPanel(new BorderLayout()); + content2.add(comBoChoixTypeGraphe_,BorderLayout.NORTH); final JPanel content=new JPanel(new BorderLayout()); - content.add(comBoChoixTypeGraphe_,BorderLayout.NORTH); + content2.add(content,BorderLayout.CENTER); + final JLabel description=new JLabel(getDescriptionImportGENE()); + + content.add(description,BorderLayout.NORTH); final JPanel container=new JPanel(layoutParamGene); content.add(container,BorderLayout.CENTER); comBoChoixTypeGraphe_.setAction(new AbstractAction(){ @@ -403,6 +424,7 @@ //layoutParamGene.next(container); // content.revalidate(); // container.revalidate(); + description.setText(getDescriptionImportGENE()); } }); @@ -416,7 +438,6 @@ listeVar[i-1]=dataG().getVariable(i); listVariablesGENE_=new JList(listeVar); listVariablesGENE_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listVariablesGENE_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); //-- creation de la liste des separators --// listeVar=new String[dataG().getNbSeparator()]; @@ -425,21 +446,26 @@ listeVar[i]=dataG().getSeparator(i); listSeparator_=new JList(listeVar); listSeparator_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listSeparator_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Valeurs num\xE9riques du s\xE9parateur de bloc"))); - + //-- panel reserv\xE9 aux profils spatiaux --// JPanel paramProfils=new JPanel(new BorderLayout()); container.add(paramProfils, TrResource.getS("Profil Spatial")); JPanel choixVar=new JPanel(new GridLayout(1,2)); - choixVar.add(listVariablesGENE_); - choixVar.add(listSeparator_); + JScrollPane pane=new JScrollPane(listVariablesGENE_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); + choixVar.add(pane); + pane=new JScrollPane(listSeparator_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Valeurs num\xE9riques du s\xE9parateur de bloc"))); + + choixVar.add(pane); paramProfils.add(choixVar,BorderLayout.NORTH); //--panel du milieu: liste de couples VAR/SEPARATOR --// modelCoupleSpatiauxGENE_=new DefaultListModel(); listCoupleSpatiauxGENE_=new JList(modelCoupleSpatiauxGENE_); - listCoupleSpatiauxGENE_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Liste des couples variable/separateur"))); - paramProfils.add(listCoupleSpatiauxGENE_,BorderLayout.CENTER); + pane=new JScrollPane(listCoupleSpatiauxGENE_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Liste des couples variable/separateur"))); + paramProfils.add(pane,BorderLayout.CENTER); //-- boutons du bas d'ajout/supression dans la liste --// BuButton ajouter=new BuButton(FudaaResource.FUDAA.getIcon("crystal_ajouter"), TrResource.getS("Ajouter")); ajouter.addActionListener(new ActionListener(){ @@ -485,25 +511,29 @@ listeVar[i-1]=dataG().getVariable(i); listVariablesGENE2_=new JList(listeVar); listVariablesGENE2_.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - listVariablesGENE2_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); listeVar=new String[dataG().getNbSeparator()]; for(int i=0;i<dataG().getNbSeparator();i++) listeVar[i]=dataG().getSeparator(i); listSeparatorDebPlage_=new JList(listeVar); listSeparatorDebPlage_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listSeparatorDebPlage_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage d\xE9part du s\xE9parateur de bloc"))); listSeparatorDebPlage_.setSelectedIndex(0); listSeparatorFinPlage_=new JList(listeVar); listSeparatorFinPlage_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listSeparatorFinPlage_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage fin du s\xE9parateur de bloc"))); listSeparatorFinPlage_.setSelectedIndex(listSeparatorDebPlage_.getModel().getSize()-1); JPanel listData=new JPanel(new GridLayout(1,2)); JPanel listData2=new JPanel(new GridLayout(2,1)); - listData.add(listVariablesGENE2_); + pane=new JScrollPane(listVariablesGENE2_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection des variables"))); + + listData.add(pane); listData.add(listData2); - listData2.add(listSeparatorDebPlage_); - listData2.add(listSeparatorFinPlage_); + pane=new JScrollPane(listSeparatorDebPlage_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage d\xE9part du s\xE9parateur de bloc"))); + listData2.add(pane); + pane=new JScrollPane(listSeparatorFinPlage_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage fin du s\xE9parateur de bloc"))); + listData2.add(pane); paramTempo.add(listData,BorderLayout.CENTER); //textField contenant le x choisi @@ -529,10 +559,8 @@ listeVar[i-1]=dataG().getVariable(i); listVariablesGENECorrlX_=new JList(listeVar); listVariablesGENECorrlX_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listVariablesGENECorrlX_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection la variable pour l'axe X"))); listVariablesGENECorrlY_=new JList(listeVar); listVariablesGENECorrlY_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listVariablesGENECorrlY_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection la variable pour l'axe Y"))); listeVar=new String[dataG().getNbSeparator()]; @@ -540,20 +568,26 @@ listeVar[i]=dataG().getSeparator(i); listSeparatorCorrel1_=new JList(listeVar); listSeparatorCorrel1_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listSeparatorCorrel1_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage associ\xE9e \xE0 la variable X"))); listSeparatorCorrel1_.setSelectedIndex(0); listSeparatorCorrel2_=new JList(listeVar); listSeparatorCorrel2_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listSeparatorCorrel2_.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage associ\xE9e \xE0 la variable Y"))); listSeparatorCorrel2_.setSelectedIndex(0); - paramCorrel.add(listVariablesGENECorrlX_); - paramCorrel.add(listSeparatorCorrel1_); - paramCorrel.add(listVariablesGENECorrlY_); - paramCorrel.add(listSeparatorCorrel2_); + pane=new JScrollPane(listVariablesGENECorrlX_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection la variable pour l'axe X"))); + paramCorrel.add(pane); + pane=new JScrollPane(listSeparatorCorrel1_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage associ\xE9e \xE0 la variable X"))); + paramCorrel.add(pane); + pane=new JScrollPane(listVariablesGENECorrlY_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("S\xE9lection la variable pour l'axe Y"))); + paramCorrel.add(pane); + pane=new JScrollPane(listSeparatorCorrel2_); + pane.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Plage associ\xE9e \xE0 la variable Y"))); + paramCorrel.add(pane); - return content; + return content2; } JPanel buildPanelParametresImportation(){ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeGENE.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeGENE.java 2008-10-03 15:29:59 UTC (rev 4030) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaWriterScopeGENE.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -65,37 +65,46 @@ EGGraphe graphe_ = data.getGraphe(); EGCourbe[] listeChoixUser = data.getCourbes(); - //-- on ajoute un pas de temps qui decrit le graphe --// - String keyPDt="X=contenu graphe"; - structure_.addSeparator(keyPDt); + //--on ajoute tous les x donn\xE9s de la courbe= UNION DE TOUTES LES COURBES--// - final EGAxeHorizontal h = graphe_.getTransformer().getXAxe(); - for (int i = listeChoixUser.length - 1; i >= 0; i--) { - final EGCourbe c = listeChoixUser[i]; - for (int j = c.getModel().getNbValues() - 1; j >= 0; j--) { - final double x = c.getModel().getX(j); - // if ( (h.containsPoint(x))) { - // -- on ajoute le x pour les variables x si il n existe pas deja --// - structure_.insertNewX(x,keyPDt); - // } - } +// final EGAxeHorizontal h = graphe_.getTransformer().getXAxe(); +// for (int i = listeChoixUser.length - 1; i >= 0; i--) { +// final EGCourbe c = listeChoixUser[i]; +// for (int j = c.getModel().getNbValues() - 1; j >= 0; j--) { +// final double x = c.getModel().getX(j); +// // if ( (h.containsPoint(x))) { +// // -- on ajoute le x pour les variables x si il n existe pas deja --// +// structure_.insertNewX(x,keyPDt); +// // } +// } +// } + + //on recherche toutes les variables pr\xE9sentes dans le graphe + for (int i = 0; i < graphe_.getModel().getNbEGObject(); i++) { + final EGObject ci = graphe_.getModel().getEGObject(i); + if (ci instanceof EGGroup) { + EGGroup groupe = (EGGroup) ci; + structure_.addVariable(groupe.getTitle()); + + } } - //-- ON INSERE LES Y CORRESPONDANTS POUR CHAQUE VARIABLES--// + + + + + //-- ON Cree un separator pour chaque courbe de chaque variables--// for (int i = 0; i < graphe_.getModel().getNbEGObject(); i++) { final EGObject ci = graphe_.getModel().getEGObject(i); if (ci instanceof EGGroup) { EGGroup groupe = (EGGroup) ci; - boolean hasAlreadyRegistered=false; - - for (int k = 0; k < groupe.getChildCount(); k++) { EGCourbeChild courbe = groupe.getCourbeAt(k); - + boolean selected = false; for (int j = 0; !selected && j < listeChoixUser.length; j++) if (listeChoixUser[j] == courbe) @@ -103,39 +112,43 @@ if (selected) { - // -- il y a au moins une courbe selectionnee pour la variable, on - // va donc enregistrer la variable dans la structure - if (!hasAlreadyRegistered) { - hasAlreadyRegistered = true; - structure_.addVariable(groupe.getTitle()); - //ACHTUNG IL FAUT AJOUTER CETTE LISTE QUI PERMETTRA AU VARIABLE D INITIALISER LEUR DATA. - structure_.getListeVarForSeparator(keyPDt).add(new ArrayList<Double>()); - } + //-- on ajoute un pas de temps qui decrit le graphe --// + String keyPDt="X= "+groupe.getTitle()+": "+courbe.getTitle(); + structure_.addSeparator(keyPDt); + + + // --ajout d toutes les valeurs X et Y--/ + for(int g = 0; g < courbe.getModel().getNbValues(); g++) { + + //on ajoute le x + structure_.insertNewX(courbe.getModel().getX(g), keyPDt); + //on ajoute le y associ\xE9 a la bonne variable + int variableEnCours=structure_.getVariablePosition(groupe.getTitle()); + structure_.addValueForVariableAtSeparator(courbe.getModel().getY(g),variableEnCours , keyPDt); - // --ajout des valeurs pour chaque X--/ - for (int g = 0; g < structure_.getAllX(keyPDt).size(); g++) { - //-- on ajoute la valeur interpol\xE9e pour les x pr\xE9cemment saisis --// - double x = structure_.getX(g,keyPDt); + +// //-- on ajoute la valeur interpol\xE9e pour les x pr\xE9cemment saisis --// +// double x = structure_.getX(g,keyPDt); +// +// //-- on v\xE9rifie que le x existe pour la courbe actuelle --// +// boolean xExistForCourbe = false; +// int emplacementYcorrespondant = -1; +// for (int l = 0; !xExistForCourbe && l < courbe.getModel().getNbValues(); l++) { +// if (courbe.getModel().getX(l) == x) { +// xExistForCourbe = true; +// emplacementYcorrespondant = l; +// } +// } - //-- on v\xE9rifie que le x existe pour la courbe actuelle --// - boolean xExistForCourbe = false; - int emplacementYcorrespondant = -1; - for (int l = 0; !xExistForCourbe && l < courbe.getModel().getNbValues(); l++) { - if (courbe.getModel().getX(l) == x) { - xExistForCourbe = true; - emplacementYcorrespondant = l; - } - } - //double yInterpole = courbe.interpol(x); // -- si le x existe dans la courbe alors on inscrit son y // correspondant pour la bonne variable--// - if (xExistForCourbe) - structure_.addValueForVariableAtSeparator(courbe.getModel().getY(emplacementYcorrespondant), structure_.getNbVariables()-1, keyPDt); - else - // -- on enregistre une valeure foireuse. - structure_.addValueForVariableAtSeparator(ScopeKeyWord.VALUE_UNDEFINED, structure_.getNbVariables()-1, keyPDt); +// if (xExistForCourbe) +// structure_.addValueForVariableAtSeparator(courbe.getModel().getY(emplacementYcorrespondant), structure_.getNbVariables()-1, keyPDt); +// else +// // -- on enregistre une valeure foireuse. +// structure_.addValueForVariableAtSeparator(ScopeKeyWord.VALUE_UNDEFINED, structure_.getNbVariables()-1, keyPDt); } } 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-03 15:29:59 UTC (rev 4030) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrPostActionLigneCourants.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -7,7 +7,7 @@ import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import org.fudaa.fudaa.tr.post.TrPostCommonImplementation; import org.fudaa.fudaa.tr.post.TrPostDialogBilan; -import org.fudaa.fudaa.tr.post.TrPostDialogCurrentLine; +import org.fudaa.fudaa.tr.post.TrPostDialogLigneCourants; import org.fudaa.fudaa.tr.post.TrPostProjet; import org.fudaa.fudaa.tr.post.TrPostVisuPanel; @@ -15,11 +15,12 @@ // final MvProfileTarget src_; TrPostProjet projet_; - + TrPostVisuPanel calque_; - public TrPostActionLigneCourants(TrPostProjet projet) { - super(MvResource.getS("Calcul des bilans"), MvResource.MV.getIcon("profile"), "BILAN"); + public TrPostActionLigneCourants(TrPostProjet projet, TrPostVisuPanel panel) { + super(MvResource.getS("Calcul des lignes de courants/trajectoires"), MvResource.MV.getIcon("profile"), "BILAN"); projet_=projet; + calque_=panel; } @@ -28,7 +29,7 @@ public void actionPerformed(final ActionEvent _e) { // -- creation du wizard depusi le calque --// - new TrPostDialogCurrentLine(projet_,projet_.getImpl()); + new TrPostDialogLigneCourants(projet_,projet_.getImpl(),calque_); } Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeCurrentLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeCurrentLine.java 2008-10-03 15:29:59 UTC (rev 4030) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeCurrentLine.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -1,198 +0,0 @@ -package org.fudaa.fudaa.tr.post; - -import java.awt.Point; -import java.util.ArrayList; - -import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.dodico.ef.EfData; -import org.fudaa.dodico.ef.EfGridData; -import org.fudaa.dodico.ef.EfGridInterface; -import org.fudaa.dodico.ef.EfNeighborMesh; -import org.fudaa.dodico.ef.interpolation.EfGridDataInterpolator; -import org.fudaa.dodico.ef.interpolation.EfInterpolator; -import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestElt; -import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestNode; -import org.fudaa.dodico.ef.operation.EfLineIntersection; -import org.fudaa.dodico.ef.operation.EfLineIntersectionParent; -import org.fudaa.dodico.h2d.type.H2dVariableType; -import org.fudaa.ebli.geometrie.GrPoint; -import org.fudaa.ebli.geometrie.GrPolygone; -import org.fudaa.fudaa.tr.common.TrResource; - - -/** - * Algorithme de Calcul les lignes de courants - * @author Adrien Hadoux - * - */ -public class TrComputeCurrentLine implements EfLineIntersectionParent{ - - -/** - * data - */ -final TrPostSource data_; - -/** - * pour interpoler les valeur - */ -final EfInterpolator interpolator_; - -ProgressionInterface prog_; - -/** - * Liste des intersections r\xE9sultats - */ -ArrayList<EfLineIntersection> listeIntersection_=null; - - -public TrComputeCurrentLine(TrPostSource data_) { - super(); - this.data_ = data_; - this.interpolator_ = data_.getInterpolator(); -} - -public void progression(String desc, int completionRate){ - if(prog_==null) - return; - prog_.setDesc(TrResource.getS(desc)); - prog_.setProgression(5); - -} -/** - * Methode appel\xE9e par l'interface de calcul des lignes de courant. - * @param init point de depart - * @param dureeIntegration duree totale de l'integration en secondes - * @param indicePdt indice du pas de temps - * @param finesse coefficient de finesse double - * @param variable la variable a utiliser - * @param prog l'interface de progression, peut etre null - * @return - */ -public ArrayList<EfLineIntersection> computeLine(GrPoint init, double dureeIntegration, int indicePdt,double finesse ,H2dVariableType variable, ProgressionInterface prog){ - prog_=prog; - //on init le temps total avec l'indice du pas de temps fourni au depart - double tempsTotal=data_.getTimeStep(indicePdt); - double oldTempsTotal; - boolean inactif=false; - - - - - while(!inactif && tempsTotal<=dureeIntegration){ - oldTempsTotal=tempsTotal; - - //etape 1 \xE9l\xE9ment englobant de init - progression("Recherche \xE9l\xE9ment englobant",5); - int eltEnglob=elementEnglobant(init); - if(eltEnglob !=-1){ - //creation de la premiere intersection - EfLineIntersection.ItemMesh intersection=new EfLineIntersection.ItemMesh(eltEnglob,init.x_,init.y_); - //recup des datas - EfData dataX=data_.getData(variable, indicePdt); - double vx=intersection.getDistanceFrom(init.x_, init.y_); - double vy=intersection.getValueBadInterpolation(dataX); - - //calcul des distances avec son voisinage - EfNeighborMesh voisinage=EfNeighborMesh.compute(data_.getGrid(), prog_); - double distanceMaxEntrePoints=0; - int[] listeEltVoisins=null; - int voisinChoisi=0; - //cas sur un noeud - if(intersection.isNodeIntersection()){ - int nbVoisins=voisinage.getNbNeighborMeshes(eltEnglob); - listeEltVoisins=new int[nbVoisins]; - for(int i=0;i<nbVoisins;i++){ - //On calcule la distance avec lequel de ces points??? - listeEltVoisins[i] =voisinage.getNeighborMesh(eltEnglob, i); - } - - }else { - //comment faire en fudaa pour les autres cas??? - } - - //calcul de la distance max - if(listeEltVoisins!=null && listeEltVoisins.length>0) - voisinChoisi=listeEltVoisins[0]; - for(int i=0;i<listeEltVoisins.length;i++){ - int eltVoisin=listeEltVoisins[i]; - // comment je fais pour avoir les coordonn\xE9es x et y du point eltVoisin??? - double x=0 ;//a remplacer par les coordonn\xE9es de eltVoisin - double y=0; - double distance=Math.sqrt((init.x_-x)*(init.x_-x) + (init.y_-y)*(init.y_-y) ); - if(distanceMaxEntrePoints>distance){ - - //ACHTUNG!! VERIFIER QUE LE t+ deltaT<dureeIntegration si on choisit cette distance - if(vy!=0 && (tempsTotal+ distance/vy<=dureeIntegration)){ - distanceMaxEntrePoints=distance; - voisinChoisi=eltVoisin; - } - } - } - - //on calcul le nouveau temps total - if(vy !=0) - tempsTotal+=distanceMaxEntrePoints/vy; - - - - - - - - } - //on verifie que l'on n'est pas inactif - if(oldTempsTotal==tempsTotal) - inactif=true; - } - - return listeIntersection_; -} - - - - -/** - * Recherche l'\xE9l\xE9lment englobant pour un point donn\xE9 - * @param _prReel - * @param grid - * @return - */ -public int elementEnglobant(final GrPoint _prReel) { - EfGridInterface grid=data_.getGrid(); - if (grid.getIndex() != null) { - final EfIndexVisitorNearestElt visitor = new EfIndexVisitorNearestElt(grid, _prReel.x_, _prReel.y_, 0); - grid.getIndex().query(EfIndexVisitorNearestNode.getEnvelope(_prReel.x_, _prReel.y_, 0), visitor); - return visitor.isIn() ? visitor.getSelected() : -1; - } - else - return -1; - } - -@Override -public void buildNeighbor(ProgressionInterface _prog) { - // TODO Auto-generated method stub - -} - -@Override -public EfGridInterface getGrid() { - // TODO Auto-generated method stub - return data_.getGrid(); -} - -@Override -public EfGridDataInterpolator getGridData() { - // TODO Auto-generated method stub - return null; -} - -@Override -public EfNeighborMesh getNeighbor() { - // TODO Auto-generated method stub - return null; -} - - - -} Copied: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeLigneCourantTrajectoire.java (from rev 4025, branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeCurrentLine.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeLigneCourantTrajectoire.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeLigneCourantTrajectoire.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -0,0 +1,353 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.Point; +import java.util.ArrayList; + +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.ef.EfGridData; +import org.fudaa.dodico.ef.EfGridInterface; +import org.fudaa.dodico.ef.EfNeighborMesh; +import org.fudaa.dodico.ef.interpolation.EfGridDataInterpolator; +import org.fudaa.dodico.ef.interpolation.EfInterpolator; +import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestElt; +import org.fudaa.dodico.ef.operation.EfIndexVisitorNearestNode; +import org.fudaa.dodico.ef.operation.EfLineIntersection; +import org.fudaa.dodico.ef.operation.EfLineIntersectionParent; +import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsMng; +import org.fudaa.dodico.ef.operation.EfLineIntersectorActivity; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.geometrie.GrPolygone; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.LineString; +import com.vividsolutions.jts.geom.PrecisionModel; + + +/** + * Algorithme de Calcul les lignes de courants + * @author Adrien Hadoux + * + */ +public class TrComputeLigneCourantTrajectoire implements EfLineIntersectionParent{ + + + /** + * data + */ + TrPostVisuPanel calque_; + final TrPostSource data_; + + /** + * pour interpoler les valeur + */ + final EfInterpolator interpolator_; + + + final EfLineIntersectorActivity lineIntersect_; + ProgressionInterface prog_; + + + ArrayList<GrPoint> listePointsARepartir_=new ArrayList<GrPoint>(); + + /** + * Liste des intersections r\xE9sultats + */ + ArrayList<EfLineIntersection> listeIntersection_=null; + + + public TrComputeLigneCourantTrajectoire(TrPostVisuPanel calque) { + super(); + calque_=calque; + this.data_ =calque.getSource(); + this.interpolator_ = data_.getInterpolator(); + this.lineIntersect_ = new EfLineIntersectorActivity(data_); + } + + + + /** + * Methode qui permet de repartir uniformement un nombre d points nb sur un segment. + * @param point1 extremites 1 du segment + * @param point2 extremite 2 du segment + * @param nbPointsARepartir nombre entier de points a repartir + * @return la liste des points repartis + */ + public static ArrayList<GrPoint> repartirUniformementPointsSurSegment(GrPoint point1, GrPoint point2, int nbPointsARepartir){ + + //on calcul leur droite d'equation + double coeff=0; + if(point1.x_-point2.x_!=0) + coeff=(point1.y_-point2.y_)/(point1.x_-point2.x_); + double ordonneeOrigine=point1.y_-coeff*point1.x_; + + + + int nbPoints=nbPointsARepartir; + if(nbPoints<2) + //on en met au moins 2 qui seront les extremites + nbPoints=2; + + + //on part du principe que le point 1 est le plus a gauche (abscisse plus petite) + if(point1.x_>point2.x_){ + GrPoint temp=new GrPoint(); + temp.initialiseAvec(point1); + point1.initialiseAvec(point2); + point2.initialiseAvec(temp); + } + + double distanceToAddEachPoint=Math.sqrt((point1.y_-point2.y_)*(point1.y_-point2.y_)+ (point1.x_-point2.x_)*(point1.x_-point2.x_))/nbPoints; + + ArrayList<GrPoint> listePointsARepartir=new ArrayList<GrPoint>(nbPoints); + + //ajout du point 1 dans la liste + listePointsARepartir.add(point1); + + // ajout des nbPoints-2 autre points + for(int i=0;i<nbPoints-2;i++){ + if(point1.x_-point2.x_!=0){ + double x=point1.x_+distanceToAddEachPoint*(i+1); + double y=coeff*x+ordonneeOrigine; + GrPoint newpoint=new GrPoint(x,y,0); + listePointsARepartir.add(newpoint); + } + else{ + //car droite perpendiculaire a l axe des x + double x=point1.x_; + double y=Math.min(point1.y_,point2.y_)+distanceToAddEachPoint*(i+1); + GrPoint newpoint=new GrPoint(x,y,0); + listePointsARepartir.add(newpoint); + } + } + + //ajout du point autre extremite + listePointsARepartir.add(point2); + + return listePointsARepartir; + } + + + + + public void progression(String desc, int completionRate){ + if(prog_==null) + return; + prog_.setDesc(TrResource.getS(desc)); + prog_.setProgression(5); + + } + /** + * Methode appel\xE9e par l'interface de calcul des lignes de courant. + * @param init point de depart + * @param dureeIntegration duree totale de l'integration en secondes + * @param indicePdt indice du pas de temps + * @param finesse coefficient de finesse double + * @param variable la variable a utiliser + * @param prog l'interface de progression, peut etre null + * @return + */ + public ArrayList<EfLineIntersection> computeLigneCourant(GrPoint extrem1segment,GrPoint extrem2segment, int nbPointsARepartirUniformement, double dureeIntegration, int indicePdt,double finesse ,H2dVariableType variable, ProgressionInterface prog){ + prog_=prog; + + + //on repartit les points uniform\xE9ment sur le segment + listePointsARepartir_=repartirUniformementPointsSurSegment(extrem1segment, extrem2segment, nbPointsARepartirUniformement); + + //test de l'algo avec le premier point + GrPoint init=listePointsARepartir_.get(0); + + + //on init le temps total avec l'indice du pas de temps fourni au depart + double tempsTotal=data_.getTimeStep(indicePdt); + double oldTempsTotal; + boolean termine=false; + + //-- variables d'initialisation + //point courant tout au long de l'algo + GrPoint pointCourant=init; + //element sur lequel on se situe a l'iteration i + int elementCourant; + //intersection courante + EfLineIntersection intersectionCourante; + //donn\xE9es r\xE9cup\xE9r\xE9es fixe pour les lignes de courants + EfData dataX; + + //initialisation + progression("Recherche \xE9l\xE9ment englobant",5); + elementCourant=elementEnglobant(pointCourant); + //creation de l'intersection avec l'\xE9l\xE9ment courant + progression("Recherche des intersection",7); + intersectionCourante=new EfLineIntersection.ItemMesh(elementCourant,pointCourant.x_,pointCourant.y_); + + //recup des datas a partir de la var et du pas de temps initial + dataX=data_.getData(variable, indicePdt); + + + + //-- Algo principal --// + + if(elementCourant !=-1){ + + while(!termine && tempsTotal<=dureeIntegration){ + oldTempsTotal=tempsTotal; + + //ajout de l'intersection dans la liste r\xE9sultats + listeIntersection_.add(intersectionCourante); + + //recherche des vitesses + double vitesseX=intersectionCourante.getDistanceFrom(pointCourant.x_, pointCourant.y_); + double vitesseY=intersectionCourante.getValueBadInterpolation(dataX); + + + //calcul des distances avec son voisinage + progression("Calcul des distances avec le voisinage",10); + EfNeighborMesh voisinage=EfNeighborMesh.compute(data_.getGrid(), prog_); + double distanceMaxEntrePoints=0; + int[] listeEltVoisins=null; + int voisinChoisi=0; + //cas sur un noeud + if(intersectionCourante.isNodeIntersection()){ + int nbVoisins=voisinage.getNbNeighborMeshes(elementCourant); + listeEltVoisins=new int[nbVoisins]; + for(int i=0;i<nbVoisins;i++){ + //On calcule la distance avec lequel de ces points??? + listeEltVoisins[i] =voisinage.getNeighborMesh(elementCourant, i); + } + + }else { + //comment faire en fudaa pour les autres cas??? + //cas des arretes + + + } + + + + + //calcul de la distance max + if(listeEltVoisins!=null && listeEltVoisins.length>0) + voisinChoisi=listeEltVoisins[0]; + for(int i=0;i<listeEltVoisins.length;i++){ + int eltVoisin=listeEltVoisins[i]; + + // coordonn\xE9es de l'\xE9l\xE9ment voisin + double x= getCoordonnees(eltVoisin).x_; + double y=getCoordonnees(eltVoisin).y_; + double distance=Math.sqrt((pointCourant.x_-x)*(pointCourant.x_-x) + (pointCourant.y_-y)*(pointCourant.y_-y) ); + if(distanceMaxEntrePoints>distance){ + //candidat potentiel + + //ACHTUNG!! VERIFIER QUE LE t+ deltaT<dureeIntegration si on choisit cette distance + if(vitesseY!=0 && (tempsTotal+ distance/vitesseY<=dureeIntegration)){ + distanceMaxEntrePoints=distance; + voisinChoisi=eltVoisin; + } + } + } + + + + //on calcul le nouveau temps total + if(vitesseY !=0) + tempsTotal+=distanceMaxEntrePoints/vitesseY; + + //on verifie que l'on n'est pas inactif + if(oldTempsTotal==tempsTotal ){ + termine=true; + }else{ + + //on a ondc un segment form\xE9 par element courant vers element choisi + GrPoint pointchoisi=new GrPoint(data_.getGrid().getCoor(voisinChoisi).x,data_.getGrid().getCoor(voisinChoisi).y,0); + + //recherche des intersection entre les points + Coordinate[] listeCoor=new Coordinate[2]; + listeCoor[0]=new Coordinate(pointCourant.x_,pointCourant.y_); + listeCoor[1]=new Coordinate(pointchoisi.x_,pointchoisi.y_); + + LineString ligne=new LineString(listeCoor,new PrecisionModel(),0); + progression("Recherche des intersections",50); + EfLineIntersectionsResultsMng res= lineIntersect_.computeForMeshes(ligne, prog_); + + + if(res.isSegmentOut(0)){ + //particules est sortie du maillage, le calcul s'arrete + termine=true; + } + else{ + //recuperationde la nouvelle intersection aui devien courante + intersectionCourante=res.getFoundIntersect(0); + + // cette intersection sera automatiquement ajout\xE9e a la liste solution a la prochaine it\xE9ration (premiere instruction du while) + + } + + } + + + }//fin du while + + } + return listeIntersection_; + } + + + + /** + * Retourne les coordonn\xE9es associ\xE9es a l \xE9l\xE9ment du point + * @param element + * @return + */ + GrPoint getCoordonnees(int element){ + GrPoint point =new GrPoint(); + calque_.getIsoLayer().getIsoModel().point(element, point); + return point; + } + + + /** + * Recherche l'\xE9l\xE9lment englobant pour un point donn\xE9 + * @param _prReel + * @param grid + * @return + */ + public int elementEnglobant(final GrPoint _prReel) { + EfGridInterface grid=data_.getGrid(); + if (grid.getIndex() != null) { + final EfIndexVisitorNearestElt visitor = new EfIndexVisitorNearestElt(grid, _prReel.x_, _prReel.y_, 0); + grid.getIndex().query(EfIndexVisitorNearestNode.getEnvelope(_prReel.x_, _prReel.y_, 0), visitor); + return visitor.isIn() ? visitor.getSelected() : -1; + } + else + return -1; + } + + @Override + public void buildNeighbor(ProgressionInterface _prog) { + // TODO Auto-generated method stub + + } + + @Override + public EfGridInterface getGrid() { + // TODO Auto-generated method stub + return data_.getGrid(); + } + + @Override + public EfGridDataInterpolator getGridData() { + // TODO Auto-generated method stub + return null; + } + + @Override + public EfNeighborMesh getNeighbor() { + // TODO Auto-generated method stub + return null; + } + + + + } Property changes on: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrComputeLigneCourantTrajectoire.java ___________________________________________________________________ Added: svn:mergeinfo + Deleted: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCurrentLine.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCurrentLine.java 2008-10-03 15:29:59 UTC (rev 4030) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCurrentLine.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -1,392 +0,0 @@ -package org.fudaa.fudaa.tr.post; - -import java.awt.BorderLayout; -import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.ArrayList; - -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JTree; -import javax.swing.ListModel; -import javax.swing.ListSelectionModel; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.DefaultTableModel; - -import org.fudaa.ctulu.CtuluAnalyze; -import org.fudaa.ctulu.CtuluLib; -import org.fudaa.ctulu.CtuluListSelection; -import org.fudaa.ctulu.ProgressionInterface; -import org.fudaa.ctulu.gui.CtuluLibSwing; -import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; -import org.fudaa.dodico.ef.EfComputeVolumeSeuil; -import org.fudaa.dodico.ef.EfData; -import org.fudaa.dodico.ef.EfDataIntegrale; -import org.fudaa.dodico.ef.EfFilter; -import org.fudaa.dodico.ef.EfFilterSelectedElement; -import org.fudaa.dodico.h2d.type.H2dVariableType; -import org.fudaa.ebli.calque.ZCalqueLigneBrisee; -import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; -import org.fudaa.ebli.commun.EbliSelectionMode; -import org.fudaa.ebli.geometrie.GrPoint; -import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.fudaa.commun.FudaaLib; -import org.fudaa.fudaa.meshviewer.layer.MvElementLayer; -import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; -import org.fudaa.fudaa.tr.common.TrResource; - -import com.memoire.bu.BuCharValidator; -import com.memoire.bu.BuStringValidator; -import com.memoire.bu.BuTextField; -import com.memoire.bu.BuValueValidator; -import com.vividsolutions.jts.geom.LinearRing; - -public class TrPostDialogCurrentLine { -/** - * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque - */ - - -ArrayList<TrPostSource> source_; -TrPostCommonImplementation impl_; -TrComputeCurrentLine algoCalcul_; - -// donnees graphiques -JDialog dialog_; - -// variables et pdt -private JPanel panelVariables_; -ListModel modelVariables_; -JList listVar_; -ListModel modelPdt_; -JList listPdt_; - -// finesse et duree et point -private JPanel panelSeuil_; -BuTextField finesse_ = new BuTextField(5); -BuTextField duree_ = new BuTextField(5); -BuTextField x_ = new BuTextField(5); -BuTextField y_ = new BuTextField(5); - -// results -JPanel panelResults_; -JLabel results_; -JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); -DefaultTableModel modelResult_; - -/** - * Constructeur reserv\xE9 au calques - * - * @param _builderParams - * @param _calque - * @param _modelGraphe - * @param _panelVariables - * @param _source - */ -public TrPostDialogCurrentLine(TrPostProjet projet,TrPostCommonImplementation impl) { - impl_ = impl; - source_ = projet.listeSrc_; - modelVariables_ = source_.get(0).getNewVarListModel(); - modelPdt_ = source_.get(0).getNewTimeListModel(); - - // -- construction de la dialog --// - buildDialog(); -} - - - - - - - -private JPanel buildresults() { - JPanel conteneur = new JPanel(new BorderLayout()); - - JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER)); - - results_ = new JLabel(""); - content.add(ajouter_); - // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); - content.add(results_); - - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); - - // -- action relatives aux resultats --// - ajouter_.addActionListener(new ActionListener() { - - public void actionPerformed(ActionEvent _e) { - if (controleDataOk()) { - computeResults(); - } - } - - }); - - modelResult_ = new DefaultTableModel(); - - JTable tableauRes = new JTable(modelResult_); - conteneur.add(tableauRes.getTableHeader(), BorderLayout.NORTH); - conteneur.add(tableauRes, BorderLayout.CENTER); - conteneur.add(content, BorderLayout.SOUTH); - return conteneur; -} - -public boolean controleDataOk() { - - - if (finesse_.getText().equals("")) { - impl_.error(TrResource.getS("La finesse doit \xEAtre d\xE9fini par un r\xE9el ")); - return false; - } - if (duree_.getText().equals("")) { - impl_.error(TrResource.getS("La dur\xE9e doit \xEAtre d\xE9fini par un r\xE9el en secondes ")); - return false; - } - if (x_.getText().equals("")) { - impl_.error(TrResource.getS("Le point doit etre form\xE9 de 2 r\xE9els ")); - return false; - } - if (y_.getText().equals("")) { - impl_.error(TrResource.getS("Le point doit etre form\xE9 de 2 r\xE9els ")); - return false; - } - if (listVar_.getSelectedIndex() == -1) { - impl_.error(TrResource.getS("Il faut choisir une variable")); - return false; - } - if (listPdt_.getSelectedIndex() == -1) { - impl_.error(TrResource.getS("Il faut choisir un pas de temps")); - return false; - } - return true; -} - -/** - * retourne la variable selectionnee - * - * @return - */ -protected H2dVariableType getSelectedVariable() { - - return (H2dVariableType) modelVariables_.getElementAt(listVar_.getSelectedIndex()); -} - -/** - * retourne l indice du pas de temps. - * - * @return - */ -protected int getSelectedTimeStep() { - return listPdt_.getSelectedIndex(); -} - -JList listeSources_; -DefaultListModel modelSources_; -private JPanel buildSources() { - JPanel conteneur = new JPanel(new BorderLayout()); - JPanel content = new JPanel(new GridLayout(1, 2)); - modelSources_=new DefaultListModel(); - for(TrPostSource source:source_) - modelSources_.addElement(source.getFile().getPath()); - listeSources_ = new JList(modelSources_); - listeSources_.setSelectedIndex(0); - listeSources_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - content.add(new JScrollPane(listeSources_)); - content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du source"))); - conteneur.add(content, BorderLayout.CENTER); - - listeSources_.addListSelectionListener(new ListSelectionListener(){ - - @Override - public void valueChanged(ListSelectionEvent e) { - //reconstruction des models de var et de pdt - if(listeSources_.getSelectedIndex()!=-1){ - modelVariables_ = source_.get(listeSources_.getSelectedIndex()).getNewVarListModel(); - modelPdt_ = source_.get(listeSources_.getSelectedIndex()).getNewTimeListModel(); - listPdt_.setModel(modelPdt_); - listVar_.setModel(modelVariables_); - } - } - - }); - - return content; - } - - -private JPanel buildVariables() { - JPanel conteneur = new JPanel(new BorderLayout()); - JPanel content = new JPanel(new GridLayout(1, 2)); - listVar_ = new JList(modelVariables_); - listVar_.setSelectedIndex(0); - listPdt_ = new JList(modelPdt_); - listPdt_.setSelectedIndex(0); - listVar_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - listPdt_.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - content.add(new JScrollPane(listVar_)); - content.add(new JScrollPane(listPdt_)); - content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix des variables et pas de temps"))); - conteneur.add(content, BorderLayout.CENTER); - conteneur.add(new JLabel(TrResource.getS("Veuillez s\xE9lectionner la variable et pas de temps")), BorderLayout.NORTH); - return content; -} - - -private JPanel buildParams() { - finesse_.setCharValidator(BuCharValidator.FLOAT); - finesse_.setStringValidator(BuStringValidator.FLOAT); - finesse_.setValueValidator(BuValueValidator.FLOAT); - duree_.setCharValidator(BuCharValidator.FLOAT); - duree_.setStringValidator(BuStringValidator.FLOAT); - duree_.setValueValidator(BuValueValidator.FLOAT); - - x_.setCharValidator(BuCharValidator.FLOAT); - x_.setStringValidator(BuStringValidator.FLOAT); - x_.setValueValidator(BuValueValidator.FLOAT); - - y_.setCharValidator(BuCharValidator.FLOAT); - y_.setStringValidator(BuStringValidator.FLOAT); - y_.setValueValidator(BuValueValidator.FLOAT); - - JPanel conteneur = new JPanel(new GridLayout(2,1)); - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix de la finesse et dur\xE9e"))); - JPanel conteneur1 = new JPanel(new FlowLayout(FlowLayout.CENTER)); - conteneur1.add(new JLabel(TrResource.getS("Finesse:"))); - conteneur1.add(finesse_); - conteneur1.add(new JLabel(TrResource.getS("Dur\xE9e d'int\xE9gration:"))); - conteneur1.add(duree_); - JPanel conteneur2 = new JPanel(new FlowLayout(FlowLayout.CENTER)); - conteneur2.add(new JLabel(TrResource.getS("Point de d\xE9part:"))); - conteneur2.add(x_); - conteneur2.add(new JLabel(TrResource.getS("-"))); - conteneur2.add(y_); - conteneur.add(conteneur1); - conteneur.add(conteneur2); - - - return conteneur; - } - -/** - * Creation du panel graphique. - * - * @return - */ -JPanel panelSources_; -public Box buildContent() { - - Box content = Box.createVerticalBox(); - -//-- panel des sources --// - if(panelSources_==null) - panelSources_=buildSources(); - content.add(panelSources_); - - // -- panel des variables --// - if (panelVariables_ == null) panelVariables_ = buildVariables(); - content.add(panelVariables_); - - // -- panelSeuil - if (panelSeuil_ == null) panelSeuil_ = buildParams(); - content.add(panelSeuil_); - - // -- panel des resultats --// - if (panelResults_ == null) panelResults_ = buildresults(); - content.add(panelResults_); - - return content; -} - -public void buildDialog() { - - // CtuluUIDialog ui_ = new - // CtuluUIDialog(listeWidgetCalque_.get(0).getCalqueController - // ().getVisuPanel()); - - final Frame f = CtuluLibSwing.getFrameAncestorHelper(impl_.getCurrentInternalFrame()); - dialog_ = new JDialog(f); - - dialog_.addWindowListener(new WindowAdapter() { - public void windowClosed(WindowEvent _e) { - // on desactive l action de suivi sur le graphe - dialog_ = null; - } - - public void windowClosing(WindowEvent _e) { - dialog_ = null; - } - }); - - dialog_.setModal(true); - dialog_.pack(); - dialog_.setTitle(getTitle()); - JPanel container = new JPanel(new BorderLayout()); - container.add(buildContent(), BorderLayout.CENTER); - container.add(new JLabel("<html> <body><b><center>" + getTitle() + "</center></b> </body></html>"), - BorderLayout.NORTH); - dialog_.setContentPane(container); - dialog_.setSize(400, 450); - dialog_.setLocationRelativeTo(CtuluLibSwing.getFrameAncestor(impl_.getCurrentInternalFrame())); - dialog_.setVisible(true); - -} - -public String getTitle() { - return TrResource.getS("Lignes de courants"); - -} - - -protected double getFinesse() { - return Double.parseDouble(finesse_.getText()); -} - -protected double getX() { - return Double.parseDouble(x_.getText()); - } -protected double getY() { - return Double.parseDouble(y_.getText()); - } - - -protected double getDuree() { - return Double.parseDouble(duree_.getText()); - } -/** - * Methode qui realise les calculs d'int\xE9grale par rapport aux donn\xE9es - */ -private void computeResults() { - - new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan")) { - public void act() { - final ProgressionInterface prog = getMainStateReceiver(); - - - //creqtion de l algo - algoCalcul_=new TrComputeCurrentLine(source_.get(listeSources_.getSelectedIndex())); - GrPoint point =new GrPoint(getX(),getY(),0); - algoCalcul_.computeLine(point, getDuree(), getSelectedTimeStep(), getFinesse(), getSelectedVariable(), null); - - // -- mise a jour du tableau de res --// - modelResult_.fireTableDataChanged(); - impl_.unsetMainMessage(); - impl_.unsetMainProgression(); - } - }.start(); -} - -} Copied: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogLigneCourants.java (from rev 4025, branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCurrentLine.java) =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogLigneCourants.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogLigneCourants.java 2008-10-03 15:32:59 UTC (rev 4031) @@ -0,0 +1,474 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.ArrayList; + +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTree; +import javax.swing.ListModel; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableModel; + +import org.fudaa.ctulu.CtuluAnalyze; +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluListSelection; +import org.fudaa.ctulu.ProgressionInterface; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; +import org.fudaa.dodico.ef.EfComputeVolumeSeuil; +import org.fudaa.dodico.ef.EfData; +import org.fudaa.dodico.ef.EfDataIntegrale; +import org.fudaa.dodico.ef.EfFilter; +import org.fudaa.dodico.ef.EfFilterSelectedElement; +import org.fudaa.dodico.h2d.type.H2dVariableType; +import org.fudaa.ebli.calque.ZCalqueLigneBrisee; +import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; +import org.fudaa.ebli.commun.EbliSelectionMode; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.meshviewer.layer.MvElementLayer; +import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuCharValidator; +import com.memoire.bu.BuStringValidator; +import com.memoire.bu.BuTextField; +import com.memoire.bu.BuValueValidator; +import com.vividsolutions.jts.geom.LinearRing; + +public class TrPostDialogLigneCourants { + /** + * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque + */ + + + //ArrayList<TrPostSource> source_; + TrPostVisuPanel calque_; + TrPostSource source_; + TrPostCommonImplementation impl_; + TrComputeLigneCourantTrajectoire algoCalcul_; + +// donnees graphiques + JDialog dialog_; + + +// choix mode + JComboBox choixMode_=new JComboBox(new String[]{"Lignes de courant","Trajectoires"}); + + +// choix segment + BuTextField x_ = new BuTextField(5); + BuTextField y_ = new BuTextField(5); + BuTextField x2_ = new BuTextField(5); + BuTextField y2_ = new BuTextField(5); + BuTextField nbPoints_ = new BuTextField(5); + + +// variables et pdt + private JPanel panelVariables_; + ListModel modelVariables_; + JList listVar_; + ListModel modelPdt_; + JList listPdt_; + +// finesse et duree et point + private JPanel panelSeuil_; + BuTextField finesse_ = new BuTextField(5); + BuTextField duree_ = new BuTextField(5); + + +// results + JPanel panelResults_; + JLabel results_; + JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); + DefaultTableModel modelResult_; + + /** + * Constructeur reserv\xE9 au calques + * + * @param _builderParams + * @param _calque + * @param _modelGraphe + * @param _panelVariables + * @param _source + */ + public TrPostDialogLigneCourants(TrPostProjet projet,TrPostCommonImplementation impl,TrPostVisuPanel calque) { + impl_ = impl; + calque_=calque; + source_ = calque.getSource(); + modelVariables_ = source_.getNewVarListModel(); + modelPdt_ = source_.getNewTimeListModel(); + + // -- construction de la dialog --// + buildDialog(); + } + + + + + + + + private JPanel buildresults() { + JPanel conteneur = new JPanel(new BorderLayout()); + + JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER)); + + results_ = new JLabel(""); + content.add(ajouter_); + // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); + content.add(results_); + + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("R\xE9sultats"))); + + // -- action relatives aux resultats --// + ajouter_.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent _e) { + if (controleDataOk()) { + computeResults(); + } + } + + }); + + modelResult_ = new DefaultTableModel(); + + JTable tableauRes = new JTable(modelResult_); + conteneur.add(tableauRes.getTableHeader(), BorderLayout.NORTH); + conteneur.add(tableauRes, BorderLayout.CENTER); + conteneur.add(content, BorderLayout.SOUTH); + return conteneur; + } + + public boolean controleDataOk() { + + + if (finesse_.getText().equals("")) { + impl_.error(TrResource.getS("La finesse doit \xEAtre d\xE9fini par un r\xE9el ")); + return false; + } + if (duree_.getText().equals("")) { + impl_.error(TrResource.getS("La dur\xE9e doit \xEAtre d\xE9fini par un r\xE9el en secondes ")); + return false; + } + if (x_.getText().equals("")) { + impl_.error(TrResource.getS("Le point doit etre form\xE9 de 2 r\xE9els ")); + return false; + } + if (nbPoints_.getText().equals("")) { + impl_.error(TrResource.getS("Le nombre de points \xE0 r\xE9partir manquant")); + return false; + } + if (y_.getText().equals("")) { + impl_.error(TrResource.getS("Le point doit etre form\xE9 de 2 r\xE9els ")); + return false; + } + if (x2_.getText().equals("")) { + impl_.error(TrResource.getS("Le point doit etre form\xE9 de 2 r\xE9els ")); + return false; + } + if (y2_.getText().equals("")) { + impl_.error(TrResource.getS("Le point doit etre form\xE9 de 2 r\xE9els ")); + return false; + } + + if (listVar_.getSelectedIndex() == -1) { + impl_.error(TrResource.getS("Il faut choisir une variable")); + return false; + } + if (listPdt_.getSelectedIndex() == -1) { + impl_.error(TrResource.getS("Il faut choisir un pas de temps")); + return false; + } + + if(getNbPoints()<2){ + nbPoints_.setText(""+2); + } + + return true; + } + + /** + * retourne la variable selectionnee + * + * @return + */ + protected H2dVariableType getSelectedVariable() { +... [truncated message content] |