From: <de...@us...> - 2008-10-01 21:14:35
|
Revision: 4022 http://fudaa.svn.sourceforge.net/fudaa/?rev=4022&view=rev Author: deniger Date: 2008-10-01 21:14:21 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsMng.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/tr/post/TrPostDialogBilan.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java Modified: branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsMng.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsMng.java 2008-10-01 21:04:27 UTC (rev 4021) +++ branches/Prepro-0.92-SNAPSHOT/dodico/src/org/fudaa/dodico/ef/operation/EfLineIntersectionsResultsMng.java 2008-10-01 21:14:21 UTC (rev 4022) @@ -84,23 +84,35 @@ public static final EfLineIntersection[] NO_DATA = new EfLineIntersection[0]; + protected static double[] computeDist(EfLineIntersectionsResultsI _res) { + final double[] dist = new double[_res.getNbIntersect()]; + for (int i = 1; i < dist.length; i++) { + EfLineIntersection i1 = _res.getIntersect(i - 1); + EfLineIntersection i2 = _res.getIntersect(i); + double distance = CtuluLibGeometrie.getDistance(i1.getX(), i1.getY(), i2.getX(), i2.getY()); + if (distance <= 0) { + System.err.println("erreur!"); + } + dist[i] = dist[i - 1] + distance; + } + return dist; + } + final EfLineIntersection[] datas_; + EfLineIntersectionsResultsI defaultRes_; double[] dist_; + final boolean forMesh_; - final EfGridDataInterpolator grid_; final LineString initLine_; + final boolean isInit_; final BitSet isOut_; + boolean isOutRemoved_; - final boolean isInit_; EfNeighborMesh neighbor_; - public EfLineIntersectionsResultsBuilder createBuilder(EfLineIntersectionsCorrectionTester _tester) { - return new EfLineIntersectionsResultsBuilder(getDefaultRes(), _tester); - } - EfLineIntersectionsResultsMng(final EfGridDataInterpolator _grid, final EfLineIntersection[] _dataPerSeg, final BitSet _isOut, final LineString _string, final boolean _forMesh) { super(); @@ -128,28 +140,34 @@ } - protected static double[] computeDist(EfLineIntersectionsResultsI _res) { - final double[] dist = new double[_res.getNbIntersect()]; - for (int i = 1; i < dist.length; i++) { - EfLineIntersection i1 = _res.getIntersect(i - 1); - EfLineIntersection i2 = _res.getIntersect(i); - double distance = CtuluLibGeometrie.getDistance(i1.getX(), i1.getY(), i2.getX(), i2.getY()); - if (distance <= 0) { - System.err.println("erreur!"); - } - dist[i] = dist[i - 1] + distance; - } - return dist; + public void buildNeighbor(final ProgressionInterface _prog) { + neighbor_ = EfNeighborMesh.compute(grid_.getGridData().getGrid(), _prog); } - private void initSeg() { - for (int i = datas_.length - 1; i >= 0; i--) { - datas_[i].setParent(this); + public EfLineIntersectionsResultsBuilder createBuilder(EfLineIntersectionsCorrectionTester _tester) { + return new EfLineIntersectionsResultsBuilder(getDefaultRes(), _tester); + } + + public EfLineIntersectionsResultsMng extract(final int _i1, final int _i2) { + final int nb = _i2 - _i1 + 1; + // on ne fait pas car c'est pas normal. + if (nb <= 1 || nb == datas_.length || datas_.length <= 2) { + return this; } + final EfLineIntersection[] newRes = new EfLineIntersection[nb]; + final BitSet out = new BitSet(nb - 1); + for (int i = _i1; i <= _i2; i++) { + final int j = i - _i1; + newRes[j] = datas_[i]; + out.set(j, isOut_.get(i)); + } + return new EfLineIntersectionsResultsMng(this, newRes, out, isOutRemoved_); + } - public void buildNeighbor(final ProgressionInterface _prog) { - neighbor_ = EfNeighborMesh.compute(grid_.getGridData().getGrid(), _prog); + public EfLineIntersectionsResultsI getDefaultRes() { + if (defaultRes_ == null) defaultRes_ = new EfLineIntersectionsResultsDefault(this); + return defaultRes_; } public double getFoundDistFromDeb(final int _idxInter) { @@ -159,10 +177,6 @@ return dist_[_idxInter]; } - public EfGridInterface getGrid() { - return grid_.getGridData().getGrid(); - } - public EfLineIntersection getFoundIntersect(final int _i) { return datas_[_i]; } @@ -171,10 +185,44 @@ return datas_ == null ? 0 : datas_.length; } + public EfGridInterface getGrid() { + return grid_.getGridData().getGrid(); + } + + public EfGridDataInterpolator getGridData() { + return grid_; + } + + /** + * @return the initLine la ligne utilisee pour construire les intersections. + */ + public LineString getInitLine() { + return initLine_; + } + public EfNeighborMesh getNeighbor() { return neighbor_; } + private void initSeg() { + for (int i = datas_.length - 1; i >= 0; i--) { + datas_[i].setParent(this); + } + } + + public EfLineIntersectionsResultsMng inversion() { + final EfLineIntersection[] newInter = new EfLineIntersection[datas_.length]; + int n = datas_.length - 1; + final BitSet newOut = new BitSet(n); + for (int i = n; i >= 0; i--) { + newInter[i] = datas_[n - i]; + newOut.set(i, isOut_.get(n - i)); + } + final EfLineIntersectionsResultsMng res = new EfLineIntersectionsResultsMng(this, newInter, newOut, true); + return res; + + } + public boolean isAllOut() { for (int i = getFoundNbIntersect() - 1; i >= 0; i--) { if (getFoundIntersect(i).isRealIntersection()) { @@ -188,13 +236,18 @@ return getFoundNbIntersect() == 0 || isAllOut(); } - EfLineIntersectionsResultsI defaultRes_; + public boolean isForMesh() { + return forMesh_; + } - public EfLineIntersectionsResultsI getDefaultRes() { - if (defaultRes_ == null) defaultRes_ = new EfLineIntersectionsResultsDefault(this); - return defaultRes_; + public boolean isInit() { + return isInit_; } + public boolean isOutRemoved() { + return isOutRemoved_; + } + public boolean isSegmentIn(final int _idxInters) { return !isSegmentOut(_idxInters); } @@ -203,43 +256,6 @@ return isOut_.get(_idxInters); } - public EfLineIntersectionsResultsMng restoreInit(final ProgressionInterface _prog) { - if (isInit_) { - return this; - } - return new EfLineIntersectorActivity(grid_).computeFor(initLine_, _prog, forMesh_); - } - - public EfLineIntersectionsResultsMng extract(final int _i1, final int _i2) { - final int nb = _i2 - _i1 + 1; - // on ne fait pas car c'est pas normal. - if (nb <= 1 || nb == datas_.length || datas_.length <= 2) { - return this; - } - final EfLineIntersection[] newRes = new EfLineIntersection[nb]; - final BitSet out = new BitSet(nb - 1); - for (int i = _i1; i <= _i2; i++) { - final int j = i - _i1; - newRes[j] = datas_[i]; - out.set(j, isOut_.get(i)); - } - return new EfLineIntersectionsResultsMng(this, newRes, out, isOutRemoved_); - - } - - public EfLineIntersectionsResultsMng inversion() { - final EfLineIntersection[] newInter = new EfLineIntersection[datas_.length]; - int n = datas_.length - 1; - final BitSet newOut = new BitSet(n); - for (int i = n; i >= 0; i--) { - newInter[i] = datas_[n - i]; - newOut.set(i, isOut_.get(n - i)); - } - final EfLineIntersectionsResultsMng res = new EfLineIntersectionsResultsMng(this, newInter, newOut, true); - return res; - - } - public EfLineIntersectionsResultsMng removeExt() { if (isOutRemoved_) { return this; @@ -264,20 +280,11 @@ } - public boolean isInit() { - return isInit_; + public EfLineIntersectionsResultsMng restoreInit(final ProgressionInterface _prog) { + if (isInit_) { + return this; + } + return new EfLineIntersectorActivity(grid_).computeFor(initLine_, _prog, forMesh_); } - public boolean isOutRemoved() { - return isOutRemoved_; - } - - public boolean isForMesh() { - return forMesh_; - } - - public EfGridDataInterpolator getGridData() { - return grid_; - } - } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2008-10-01 21:04:27 UTC (rev 4021) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/FudaaCourbeWizardImportScope.java 2008-10-01 21:14:21 UTC (rev 4022) @@ -91,6 +91,8 @@ //choix donnees S et T BuTextField plageDeb_=new BuTextField(5); BuTextField plageFin_=new BuTextField(5); + double xMin; + double xMax; JList listVariables_; @@ -145,13 +147,11 @@ @Override public int getStepCount() { - // TODO Auto-generated method stub return 2; } @Override public String getStepText() { - // TODO Auto-generated method stub return null; } @@ -292,7 +292,6 @@ * Construit le panel de choix des donn\xE9es a importer pour les formats s et t * @return */ - double Xmin,Xmax; JPanel buildPanelScopeSorT(){ JPanel content=new JPanel(new BorderLayout()); @@ -315,17 +314,17 @@ plageFin_.setValueValidator(BuValueValidator.FLOAT); //-- on init les plages --// - Xmin=dataST().getXMin(); - plageDeb_.setText(""+Xmin); - Xmax=dataST().getXMax(); - plageFin_.setText(""+Xmax); + xMin=dataST().getXMin(); + plageDeb_.setText(""+xMin); + xMax=dataST().getXMax(); + plageFin_.setText(""+xMax); JPanel plages=new JPanel(new FlowLayout(FlowLayout.CENTER)); plages.add(new JLabel(TrResource.getS("Choisir la plage des abscisses"))); plages.add(plageDeb_); plages.add(new JLabel("-")); plages.add(plageFin_); - plages.add(new JLabel("(Min: "+Xmin+", Max: "+Xmax+")")); + plages.add(new JLabel("(Min: "+xMin+", Max: "+xMax+")")); content.add(plages,BorderLayout.SOUTH); return content; @@ -381,7 +380,7 @@ //verifier que les plages ne sont pas depassees double valDeb=Double.parseDouble(plageDeb_.getText()); double valFin=Double.parseDouble(plageFin_.getText()); - if(valDeb<Xmin || Xmax<valFin) + if(valDeb<xMin || xMax<valFin) r |= BuButtonPanel.TERMINER; } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-10-01 21:04:27 UTC (rev 4021) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogBilan.java 2008-10-01 21:14:21 UTC (rev 4022) @@ -32,6 +32,7 @@ import org.fudaa.ctulu.gui.CtuluTaskOperationGUI; import org.fudaa.dodico.ef.EfData; import org.fudaa.dodico.ef.EfDataIntegrale; +import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsBuilder; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsI; import org.fudaa.dodico.ef.operation.EfLineIntersectionsResultsMng; import org.fudaa.dodico.ef.operation.EfLineIntersectorActivity; @@ -40,6 +41,7 @@ import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.meshviewer.profile.MvProfileCoteTester; import org.fudaa.fudaa.meshviewer.profile.MvProfileTreeModel; import org.fudaa.fudaa.tr.common.TrResource; @@ -54,35 +56,34 @@ * Wizard pour gerer les bilans des courbes. * * @author Adrien Hadoux - * */ public class TrPostDialogBilan { /** * booleen qui indique si le wizard a \xE9t\xE9t lanc\xE9 depuis un calque */ - + private boolean startWithCalque_ = true; TrPostSource source_; TrPostVisuPanel calque_; MvProfileTreeModel modelGraphe_; TrPostCommonImplementation impl_; EfDataIntegrale resCalcul_ = new EfDataIntegrale(); - + // donnees graphiques JDialog dialog_; - + // seuil private JPanel panelSeuil_; BuTextField seuil_ = new BuTextField(5); - + // variables et pdt private JPanel panelVariables_; ListModel modelVariables_; JList listVar_; ListModel modelPdt_; JList listPdt_; - + // isolignes private JPanel panelIsolignes_; JCheckBox boxSelectLineAuto_ = new JCheckBox(TrResource.getS("Choisir l'isoligne du calque")); @@ -91,13 +92,13 @@ BuTextField textX2 = new BuTextField(10); BuTextField textY1 = new BuTextField(10); BuTextField textY2 = new BuTextField(10); - + // results JPanel panelResults_; JLabel results_; JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); DefaultTableModel modelResult_; - + /** * Constructeur reserv\xE9 au calques * @@ -115,7 +116,7 @@ modelVariables_ = source_.getNewVarListModel(); modelPdt_ = source_.getNewTimeListModel(); startWithCalque_ = true; - + // -- construction de la dialog --// buildDialog(); } @@ -140,21 +141,21 @@ // -- construction de la dialog --// buildDialog(); } - + /** * Construit le panel des variables * * @return */ private JPanel buildIsoLignes() { - JPanel content=new JPanel(new BorderLayout()); + JPanel content = new JPanel(new BorderLayout()); JPanel panelChek = new JPanel(new FlowLayout(FlowLayout.CENTER)); panelChek.add(new JLabel(TrResource.getS("Choisir l'isoligne du calque"))); panelChek.add(boxSelectLineAuto_); panelChek.add(new JLabel(TrResource.getS("Cr\xE9er manuellement l'isoligne"))); panelChek.add(boxSelectLineManu_); content.add(panelChek, BorderLayout.NORTH); - + JPanel center = new JPanel(new GridLayout(2, 1)); JPanel center1 = new JPanel(new FlowLayout(FlowLayout.CENTER)); center1.add(new JLabel("Point 1 X:")); @@ -170,7 +171,7 @@ center.add(center2); content.add(center, BorderLayout.CENTER); content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix de l'isoligne"))); - + // -- init et gestion des evenements --// textX1.setCharValidator(BuCharValidator.FLOAT); textX1.setStringValidator(BuStringValidator.FLOAT); @@ -187,7 +188,7 @@ textY2.setCharValidator(BuCharValidator.FLOAT); textY2.setStringValidator(BuStringValidator.FLOAT); textY2.setValueValidator(BuValueValidator.FLOAT); - + boxSelectLineAuto_.setAction(new AbstractAction() { public void actionPerformed(ActionEvent _e) { boolean enabled = false; @@ -196,10 +197,8 @@ textY1.setEnabled(enabled); textY2.setEnabled(enabled); boxSelectLineManu_.setSelected(false); - if (boxSelectLineAuto_.isSelected()) - ajouter_.setEnabled(true); - else - ajouter_.setEnabled(false); + if (boxSelectLineAuto_.isSelected()) ajouter_.setEnabled(true); + else ajouter_.setEnabled(false); } }); @@ -211,14 +210,12 @@ textY1.setEnabled(enabled); textY2.setEnabled(enabled); boxSelectLineAuto_.setSelected(false); - if (boxSelectLineManu_.isSelected()) - ajouter_.setEnabled(true); - else - ajouter_.setEnabled(false); + if (boxSelectLineManu_.isSelected()) ajouter_.setEnabled(true); + else ajouter_.setEnabled(false); } }); - + // -- test si une ligne a ete au prealable selectionnee par l user sur le // calque --// if (calque_ != null && getSelectedLineOfCalque() != null) { @@ -229,14 +226,14 @@ textY1.setEnabled(enabled); textY2.setEnabled(enabled); boxSelectLineManu_.setSelected(false); - + } else { boxSelectLineAuto_.setSelected(false); boxSelectLineManu_.setSelected(true); // impossible de choisir cetet checkbox boxSelectLineAuto_.setEnabled(false); } - + return content; } @@ -250,29 +247,27 @@ double y1 = Double.parseDouble(textY1.getText()); double x2 = Double.parseDouble(textX2.getText()); double y2 = Double.parseDouble(textY2.getText()); - - + final Coordinate[] cs = new Coordinate[2]; cs[0] = new Coordinate(x1, y1); cs[1] = new Coordinate(x2, y2); - + return GISGeometryFactory.INSTANCE.createLineString(cs); } - - + 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(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() { @@ -283,32 +278,30 @@ } }); - + modelResult_ = new DefaultTableModel() { public int getColumnCount() { return 3; } + public String getColumnName(int _column) { - if (_column == 0) - return "Zone positive"; - else if (_column == 1) - return "Zone n\xE9gative"; - else - return "R\xE9sultat"; + if (_column == 0) return "Zone positive"; + else if (_column == 1) return "Zone n\xE9gative"; + else return "R\xE9sultat"; } + public int getRowCount() { return 1; } + public boolean isCellEditable(int _row, int _column) { return false; } + public Object getValueAt(int _row, int _column) { - if (_column == 1) - return resCalcul_.getZoneMoins(); - else if (_column == 0) - return resCalcul_.getZonePlus(); - else - return resCalcul_.getResultat(); + if (_column == 1) return resCalcul_.getZoneMoins(); + else if (_column == 0) return resCalcul_.getZonePlus(); + else return resCalcul_.getResultat(); } }; @@ -318,43 +311,42 @@ conteneur.add(content, BorderLayout.SOUTH); return conteneur; } - - + public boolean controleDataOk() { if (boxSelectLineManu_.isSelected()) { - if (textX1.getText().equals("")){ - impl_.error(TrResource.getS("Point non saisi correctement")); - return false; - + if (textX1.getText().equals("")) { + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } - if (textX2.getText().equals("")){ - impl_.error(TrResource.getS("Point non saisi correctement")); - return false; - + if (textX2.getText().equals("")) { + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } - if (textY1.getText().equals("")){ - impl_.error(TrResource.getS("Point non saisi correctement")); - return false; - + if (textY1.getText().equals("")) { + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } - if (textY2.getText().equals("")){ - impl_.error(TrResource.getS("Point non saisi correctement")); - return false; - } + if (textY2.getText().equals("")) { + impl_.error(TrResource.getS("Point non saisi correctement")); + return false; + } } - - if(seuil_.getText().equals("")){ - impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); - return false; - } - if(listVar_.getSelectedIndex()==-1){ - impl_.error(TrResource.getS("Il faut choisir une variable")); + + if (seuil_.getText().equals("")) { + impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); return false; } - if(listPdt_.getSelectedIndex()==-1){ - impl_.error(TrResource.getS("Il faut choisir un pas de temps")); + 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; } @@ -365,12 +357,10 @@ */ protected LineString getSelectedLineOfCalque() { // pas de calque s\xE9lectionn\xE9 - if (!(calque_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { - return null; - } + if (!(calque_.getArbreCalqueModel().getSelectedCalque() instanceof ZCalqueAffichageDonneesInterface)) { return null; } return ((ZCalqueAffichageDonneesInterface) calque_.getArbreCalqueModel().getSelectedCalque()).getSelectedLine(); } - + /** * retourne la variable selectionnee * @@ -389,13 +379,11 @@ protected int getSelectedTimeStep() { return listPdt_.getSelectedIndex(); } - - + protected double getSeuil() { - return Double.parseDouble(seuil_.getText()); + return Double.parseDouble(seuil_.getText()); } - - + private JPanel buildVariables() { JPanel conteneur = new JPanel(new BorderLayout()); JPanel content = new JPanel(new GridLayout(1, 2)); @@ -409,22 +397,19 @@ 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); + conteneur.add(new JLabel(TrResource.getS("Veuillez s\xE9lectionner la variable et pas de temps")), BorderLayout.NORTH); return content; } - - - private JPanel buildSeuil(){ + + private JPanel buildSeuil() { seuil_.setCharValidator(BuCharValidator.FLOAT); seuil_.setStringValidator(BuStringValidator.FLOAT); seuil_.setValueValidator(BuValueValidator.FLOAT); - + JPanel conteneur = new JPanel(new FlowLayout(FlowLayout.CENTER)); conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du seuil"))); - conteneur.add( seuil_); - + conteneur.add(seuil_); + return conteneur; } @@ -436,41 +421,32 @@ public Box buildContent() { Box content = Box.createVerticalBox(); - + // -- panel des isolignes --// - if (panelIsolignes_ == null) - panelIsolignes_ = buildIsoLignes(); + if (panelIsolignes_ == null) panelIsolignes_ = buildIsoLignes(); content.add(panelIsolignes_); - + // -- panel des variables --// - if (panelVariables_ == null) - panelVariables_ = buildVariables(); + if (panelVariables_ == null) panelVariables_ = buildVariables(); content.add(panelVariables_); - - + // -- panelSeuil - if (panelSeuil_ == null) - panelSeuil_ = buildSeuil(); + if (panelSeuil_ == null) panelSeuil_ = buildSeuil(); content.add(panelSeuil_); - + // -- panel des resultats --// - if (panelResults_ == null) - panelResults_ = buildresults(); + 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); @@ -503,52 +479,53 @@ return TrResource.getS("Bilans"); } - + /** * 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(); + new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan")) { + public void act() { + final ProgressionInterface prog = getMainStateReceiver(); // -- calcul de la EfLineIntersectionsResultsMng --// impl_.setMainMessage(FudaaLib.getS("Calcul des intersections")); impl_.setMainProgression(10); - EfLineIntersectionsResultsMng lineRes = null; - if (startWithCalque_) { - EfLineIntersectorActivity lineIntersect = new EfLineIntersectorActivity(calque_.getSource()); - if (boxSelectLineAuto_.isSelected()) - lineRes = lineIntersect.computeForMeshes(getSelectedLineOfCalque(), prog); - else - lineRes = lineIntersect.computeForMeshes(createLineString(), prog); - } else { - lineRes = modelGraphe_.getResMesh(); - } - EfLineIntersectionsResultsI interfaceRes = lineRes.getDefaultRes(); - + EfLineIntersectionsResultsI interfaceRes = null; + H2dVariableType selectedVariable = getSelectedVariable(); + if (startWithCalque_) { + EfLineIntersectorActivity lineIntersect = new EfLineIntersectorActivity(calque_.getSource()); + LineString lineString = boxSelectLineAuto_.isSelected() ? getSelectedLineOfCalque() : createLineString(); + + interfaceRes = (source_.isElementVar(selectedVariable) ? lineIntersect.computeForMeshes(lineString, prog) + : lineIntersect.computeForNodes(lineString, prog)).getDefaultRes(); + } else { + //TODO a continuer... + interfaceRes = modelGraphe_.getBuilderFor(selectedVariable).getInitRes(); + } + + // le builder permet de corriger les erreurs concernant les cote d'eau / bathymetrie + EfLineIntersectionsResultsBuilder builder = new EfLineIntersectionsResultsBuilder(interfaceRes, + new MvProfileCoteTester()); // -- calcul des efdata --// impl_.setMainProgression(30); impl_.setMainMessage(CtuluLib.getS("Calcul des donn\xE9es pour les pas de temps et variables r\xE9cup\xE9r\xE9s")); - EfData data = source_.getData(getSelectedVariable(), getSelectedTimeStep()); - - - + + EfData data = source_.getData(selectedVariable, getSelectedTimeStep()); + // -- calcul de l'int\xE9grale --// impl_.setMainProgression(70); impl_.setMainMessage(CtuluLib.getS("Calcul de l'int\xE9grale")); - - resCalcul_ = EfDataIntegrale.integrerMethodeTrapeze(interfaceRes, data, getSeuil()); - - // -- mise a jour du tableau de res --// - modelResult_.fireTableDataChanged(); - - - impl_.unsetMainMessage(); - impl_.unsetMainProgression(); - } - }.start(); - } - + resCalcul_ = EfDataIntegrale.integrerMethodeTrapeze(builder.createResults(getSelectedTimeStep(), prog), data, + getSeuil()); + + // -- mise a jour du tableau de res --// + modelResult_.fireTableDataChanged(); + + impl_.unsetMainMessage(); + impl_.unsetMainProgression(); + } + }.start(); + } } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-01 21:04:27 UTC (rev 4021) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDialogCubature.java 2008-10-01 21:14:21 UTC (rev 4022) @@ -40,7 +40,9 @@ import org.fudaa.dodico.mesure.EvolutionFileFormat; import org.fudaa.ebli.calque.ZCalqueAffichageDonneesInterface; import org.fudaa.ebli.calque.ZCalqueLigneBrisee; +import org.fudaa.ebli.calque.ZCalqueSelectionInteractionAbstract.SelectionMode; import org.fudaa.ebli.calque.find.CalqueFindCourbeTreeModel; +import org.fudaa.ebli.commun.EbliSelectionMode; import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.meshviewer.layer.MvElementLayer; @@ -77,12 +79,10 @@ ListModel modelPdt_; JList listPdt_; - - //seuil + // seuil private JPanel panelSeuil_; BuTextField seuil_ = new BuTextField(5); - - + // isolignes private JPanel panelIsolignes_; JTree treeLignes_; @@ -93,6 +93,7 @@ JLabel results_; JButton ajouter_ = new JButton("Valider", EbliResource.EBLI.getIcon("crystal_valider")); DefaultTableModel modelResult_; + /** * Constructeur reserv\xE9 au calques * @@ -137,10 +138,10 @@ buildDialog(); } - protected JTree buildTree() { return CalqueFindCourbeTreeModel.createCalqueTree(lineTreeModel_, true); } + /** * Construit le panel des variables * @@ -153,101 +154,96 @@ content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix de la ligne bris\xE9e du calque"))); return content; } - - private JPanel buildSeuil(){ - seuil_.setCharValidator(BuCharValidator.FLOAT); - seuil_.setStringValidator(BuStringValidator.FLOAT); - seuil_.setValueValidator(BuValueValidator.FLOAT); - - JPanel conteneur = new JPanel(new FlowLayout(FlowLayout.CENTER)); - conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du seuil"))); - conteneur.add( seuil_); - - return conteneur; - } + private JPanel buildSeuil() { + seuil_.setCharValidator(BuCharValidator.FLOAT); + seuil_.setStringValidator(BuStringValidator.FLOAT); + seuil_.setValueValidator(BuValueValidator.FLOAT); + + JPanel conteneur = new JPanel(new FlowLayout(FlowLayout.CENTER)); + conteneur.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Choix du seuil"))); + conteneur.add(seuil_); + + return conteneur; + } + 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() { + JPanel conteneur = new JPanel(new BorderLayout()); - public void actionPerformed(ActionEvent _e) { - if (controleDataOk()) { - computeResults(); - } - } + JPanel content = new JPanel(new FlowLayout(FlowLayout.CENTER)); - }); - - modelResult_ = new DefaultTableModel() { - public int getColumnCount() { - return 3; - } - public String getColumnName(int _column) { - if (_column == 1) - return "Zone positive"; - else if (_column == 0) - return "Zone n\xE9gative"; - else - return "R\xE9sultat"; - } - public int getRowCount() { - return 1; - } - public boolean isCellEditable(int _row, int _column) { - return false; - } - public Object getValueAt(int _row, int _column) { - if (_column == 0) - return resCalcul_.getZoneMoins(); - else if (_column == 1) - return resCalcul_.getZonePlus(); - else - return resCalcul_.getResultat(); - } - }; + results_ = new JLabel(""); + content.add(ajouter_); + // content.add(new JLabel(TrResource.getS("R\xE9sultat:"))); + content.add(results_); - JTable tableauRes = new JTable(modelResult_); - conteneur.add(tableauRes.getTableHeader(), BorderLayout.NORTH); - conteneur.add(tableauRes, BorderLayout.CENTER); - conteneur.add(content, BorderLayout.SOUTH); - return conteneur; - } + 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() { + public int getColumnCount() { + return 3; + } + + public String getColumnName(int _column) { + if (_column == 1) return "Zone positive"; + else if (_column == 0) return "Zone n\xE9gative"; + else return "R\xE9sultat"; + } + + public int getRowCount() { + return 1; + } + + public boolean isCellEditable(int _row, int _column) { + return false; + } + + public Object getValueAt(int _row, int _column) { + if (_column == 0) return resCalcul_.getZoneMoins(); + else if (_column == 1) return resCalcul_.getZonePlus(); + else return resCalcul_.getResultat(); + } + }; + + 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 (treeLignes_.getSelectionCount() == 0){ - impl_.error(TrResource.getS("Il faut choisir une ligne bris\xE9e")); - return false; - } - if(seuil_.getText().equals("")){ - impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); - return false; - } - if(listVar_.getSelectedIndex()==-1){ - impl_.error(TrResource.getS("Il faut choisir une variable")); + + if (treeLignes_.getSelectionCount() == 0) { + impl_.error(TrResource.getS("Il faut choisir une ligne bris\xE9e")); return false; } - if(listPdt_.getSelectedIndex()==-1){ - impl_.error(TrResource.getS("Il faut choisir un pas de temps")); + if (seuil_.getText().equals("")) { + impl_.error(TrResource.getS("Le seuil doit \xEAtre d\xE9fini par un r\xE9el (y=cste)")); 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 * @@ -294,23 +290,19 @@ Box content = Box.createVerticalBox(); // -- panel des isolignes --// - if (panelIsolignes_ == null) - panelIsolignes_ = buildIsoLignes(); + if (panelIsolignes_ == null) panelIsolignes_ = buildIsoLignes(); content.add(panelIsolignes_); // -- panel des variables --// - if (panelVariables_ == null) - panelVariables_ = buildVariables(); + if (panelVariables_ == null) panelVariables_ = buildVariables(); content.add(panelVariables_); // -- panelSeuil - if (panelSeuil_ == null) - panelSeuil_ = buildSeuil(); + if (panelSeuil_ == null) panelSeuil_ = buildSeuil(); content.add(panelSeuil_); - + // -- panel des resultats --// - if (panelResults_ == null) - panelResults_ = buildresults(); + if (panelResults_ == null) panelResults_ = buildresults(); content.add(panelResults_); return content; @@ -357,24 +349,21 @@ /** * Recupere la ligne brisee du tree + * * @return */ public LinearRing getSelectedLineInTree() { - if (treeLignes_.isSelectionEmpty()) { - return null; - } - final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) treeLignes_.getSelectionPath() - .getLastPathComponent(); - final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) node.getUserObject(); - return (LinearRing) cq.getModele().getGeomData().getGeometry(node.getIdxPoly()); - } - - + if (treeLignes_.isSelectionEmpty()) { return null; } + final CalqueFindCourbeTreeModel.LayerNode node = (CalqueFindCourbeTreeModel.LayerNode) treeLignes_ + .getSelectionPath().getLastPathComponent(); + final ZCalqueLigneBrisee cq = (ZCalqueLigneBrisee) node.getUserObject(); + return (LinearRing) cq.getModele().getGeomData().getGeometry(node.getIdxPoly()); + } + protected double getSeuil() { - return Double.parseDouble(seuil_.getText()); - } - - + return Double.parseDouble(seuil_.getText()); + } + /** * Methode qui realise les calculs d'int\xE9grale par rapport aux donn\xE9es */ @@ -383,37 +372,44 @@ new CtuluTaskOperationGUI(impl_, FudaaLib.getS("Calcul Bilan")) { public void act() { final ProgressionInterface prog = getMainStateReceiver(); - - //-- calcul du ef filter --// + + // -- calcul du ef filter --// impl_.setMainProgression(10); impl_.setMainMessage(CtuluLib.getS("R\xE9cup\xE9ration des lignes bris\xE9es")); EfFilter selectedElt; - MvElementLayer layer=calque_.getGridGroup().getPolygonLayer(); - CtuluListSelection listSelect=layer.selection(getSelectedLineInTree(), 0); - selectedElt=new EfFilterSelectedElement(listSelect,source_.getGrid()); - - + MvElementLayer layer = calque_.getGridGroup().getPolygonLayer(); + CtuluListSelection listSelect = layer.selection(getSelectedLineInTree(), EbliSelectionMode.MODE_ONE);// le mode + // ONE veut + // dire que + // si un + // point du + // polygone + // est + // selectionne, + // le poly + // l'est + selectedElt = new EfFilterSelectedElement(listSelect, source_.getGrid()); + // -- calcul des efdata --// impl_.setMainProgression(30); impl_.setMainMessage(CtuluLib.getS("Calcul des donn\xE9es pour les pas de temps et variables r\xE9cup\xE9r\xE9s")); EfData data = source_.getData(getSelectedVariable(), getSelectedTimeStep()); - // -- calcul de l'int\xE9grale --// + // -- calcul de l'int\xE9grale --// impl_.setMainProgression(70); impl_.setMainMessage(CtuluLib.getS("Calcul de l'int\xE9grale")); - - EfComputeVolumeSeuil compute= EfComputeVolumeSeuil.getVolumeComputer(selectedElt, prog, source_, getSelectedVariable(), getSelectedTimeStep(), getSeuil(), new CtuluAnalyze()); - - resCalcul_ =compute.getVolume(getSelectedTimeStep()); - - // -- mise a jour du tableau de res --// + + EfComputeVolumeSeuil compute = EfComputeVolumeSeuil.getVolumeComputer(selectedElt, prog, source_, + getSelectedVariable(), getSelectedTimeStep(), getSeuil(), new CtuluAnalyze()); + + resCalcul_ = compute.getVolume(getSelectedTimeStep()); + + // -- mise a jour du tableau de res --// modelResult_.fireTableDataChanged(); impl_.unsetMainMessage(); impl_.unsetMainProgression(); } }.start(); } - } - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |