You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(46) |
Jul
(37) |
Aug
(154) |
Sep
(140) |
Oct
(132) |
Nov
(104) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(113) |
Feb
(73) |
Mar
(102) |
Apr
(106) |
May
(114) |
Jun
(67) |
Jul
(116) |
Aug
(48) |
Sep
(108) |
Oct
(296) |
Nov
(56) |
Dec
(53) |
2010 |
Jan
(95) |
Feb
(31) |
Mar
(40) |
Apr
(12) |
May
(10) |
Jun
(27) |
Jul
(19) |
Aug
(81) |
Sep
(48) |
Oct
(45) |
Nov
(40) |
Dec
(7) |
2011 |
Jan
(16) |
Feb
(32) |
Mar
(55) |
Apr
(38) |
May
(24) |
Jun
(37) |
Jul
(12) |
Aug
(16) |
Sep
(97) |
Oct
(90) |
Nov
(101) |
Dec
(89) |
2012 |
Jan
(18) |
Feb
(2) |
Mar
(54) |
Apr
(69) |
May
(97) |
Jun
(131) |
Jul
(70) |
Aug
(48) |
Sep
(48) |
Oct
(119) |
Nov
(194) |
Dec
(60) |
2013 |
Jan
(73) |
Feb
(35) |
Mar
(42) |
Apr
(28) |
May
(7) |
Jun
(17) |
Jul
(27) |
Aug
(10) |
Sep
(38) |
Oct
(12) |
Nov
(4) |
Dec
(16) |
2014 |
Jan
(33) |
Feb
(37) |
Mar
(19) |
Apr
(3) |
May
(47) |
Jun
(26) |
Jul
(22) |
Aug
|
Sep
(10) |
Oct
(30) |
Nov
(24) |
Dec
(19) |
2015 |
Jan
(13) |
Feb
(16) |
Mar
(36) |
Apr
(19) |
May
(5) |
Jun
(5) |
Jul
(3) |
Aug
(11) |
Sep
(22) |
Oct
(7) |
Nov
(14) |
Dec
|
2016 |
Jan
|
Feb
(26) |
Mar
(13) |
Apr
(61) |
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
(27) |
Nov
(14) |
Dec
(21) |
2017 |
Jan
(30) |
Feb
(4) |
Mar
(3) |
Apr
(5) |
May
(69) |
Jun
(29) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <had...@us...> - 2009-02-17 18:40:24
|
Revision: 4480 http://fudaa.svn.sourceforge.net/fudaa/?rev=4480&view=rev Author: hadouxad Date: 2009-02-17 18:40:20 +0000 (Tue, 17 Feb 2009) Log Message: ----------- # Gestion des marqueurs multiples: affichage, alignement,valeur trac?\195?\169, persistance des marqueurs # Modification des donn?\195?\169es courbes pour les formats scop # Modification de l'action d'?\195?\169dition des paramteres des graphes: le panel est plus complet et permet en une seule interface de modifier l'ensemble des courbes (et non plus devoir cliquer sur la courbe au pr?\195?\169alable...) Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibString.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePalette.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigureSectionBuilder.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeConfigureTarget.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGFillePanel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGObject.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGPaletteLegendeGraphe.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/courbe/ScopeCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteTargetInterfaceReload.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeMarqueur.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/FudaaHelpPDFViewer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostDocPdfFille.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibString.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibString.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/CtuluLibString.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -322,7 +322,17 @@ } return r.toString(); } - + + public static String arrayToString(final boolean[] _o, final String _sep) { + if (_o == null) { return getNullString(); } + if (_o.length == 0) { return getEmptyTableau(); } + final StringBuffer r = new StringBuffer(); + r.append(_o[0]); + for (int i = 1; i < _o.length; i++) { + r.append(_sep).append(_o[i]); + } + return r.toString(); + } /** * @param _o le tableau d'entier a voir * @return une chaine contenant tous les entiers separees par des virgules @@ -654,6 +664,27 @@ return res.toNativeArray(); } + + public static boolean[] parseStringBoolean(final String _s, final String _sepChar) { + if ((_s == null) || (_sepChar == null)) { return null; } + final List l = (parseStringList(_s, _sepChar)); + final List<Boolean> res = new ArrayList<Boolean>(); + for (int i = 0; i < l.size(); i++) { + try { + res.add(Boolean.parseBoolean((String) l.get(i))); + } catch (final NumberFormatException _evt) { + FuLog.error(_evt); + + } + } + boolean[] tab=new boolean[res.size()]; + int cpt=0; + for(Boolean bool:res) + tab[cpt++]=bool.booleanValue(); + + return tab; + } + /** * Permet de decouper une chaine grace a un separateur. Par exemple, l'appel parseString("1;3;4" , ";") renvoie * [1,3,4]; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePalette.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePalette.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePalette.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -79,6 +79,10 @@ public void paletteDeactivated() {} public boolean setPalettePanelTarget(final Object _target) { + return setPalettePanelTarget(_target, -1); + } + + public boolean setPalettePanelTarget(final Object _target,int indiceSelecteurToShow) { BSelecteurTargetInterface vis = null; boolean enable = false; BConfigurableInterface conf = null; @@ -90,10 +94,19 @@ vis = target.getVisibleTitleTarget(); enable = target.isTitleModifiable(); conf = cs[0]; + + //-- ajout de la palette en cours dans le cas des objets reload: permet l'ajout en cours de route de bselecteurInterface --// + if(target instanceof BConfigurePaletteTargetInterfaceReload){ + ((BConfigurePaletteTargetInterfaceReload)target).setPalette(this); + } + } } setTitleVisibleTarget(vis, enable); - setTargetConf(conf); + if(indiceSelecteurToShow!=-1) + setTargetConf(conf,indiceSelecteurToShow); + else + setTargetConf(conf); return res; } @@ -105,7 +118,11 @@ txtTitle_.tf_.setEnabled(_txtEnable); } - public boolean setTargetConf(final BConfigurableInterface _target) { + public boolean setTargetConf(final BConfigurableInterface _target){ + return setTargetConf(_target, -1); + } + + public boolean setTargetConf(final BConfigurableInterface _target,int tabIndiceToAffiche) { // on supprime l'ancienne configuration if (builder_ != null) { if (builder_.pn_ != null) { @@ -116,7 +133,7 @@ } } builder_ = new BConfigureSectionBuilder(_target); - builder_.buildTab(); + builder_.buildTab(tabIndiceToAffiche); builder_.updateTarget(); if (!builder_.isEmpty()) { add(builder_.pn_, BuBorderLayout.CENTER); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteTargetInterfaceReload.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteTargetInterfaceReload.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigurePaletteTargetInterfaceReload.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -0,0 +1,24 @@ +package org.fudaa.ebli.controle; + +import java.util.Map; + +/** + * BConfigurePaletteTargetInterface custom qui permet de rejouer les donn\xE9es de sa palette en fonction des modifications. + * Utile dans le cas d'ajout de BSelecteurInterface en cours de route. + * @author Adrien Hadoux + * + */ +public interface BConfigurePaletteTargetInterfaceReload extends BConfigurePaletteTargetInterface{ + + public BConfigurePalette getPalette(); + public void setPalette(BConfigurePalette pal); + + /** + * Recharger la palette en cas de necessit\xE9. + * @param infos map qui peut contenir des infos sur le BSelecteurInterface a initialiser... + * @return + */ + public boolean reloadPalette(Map infos); + + +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigureSectionBuilder.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigureSectionBuilder.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/controle/BConfigureSectionBuilder.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -379,7 +379,19 @@ } } + + protected void buildTab(int i) { + buildTab(); + if(i>=0) + selectTab(i); + } + public void selectTab(int i){ + if(pn_==null || !(pn_ instanceof BuTabbedPane)) + return; + ((BuTabbedPane)pn_).setSelectedIndex(i); + } + protected void updateTarget() { if (!CtuluLibArray.isEmpty(sel_)) { for (int i = 0; i < sel_.length; i++) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -18,8 +18,10 @@ import java.awt.Shape; import java.awt.Stroke; import java.beans.PropertyChangeListener; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Map; import javax.swing.SwingConstants; import javax.swing.tree.TreeNode; @@ -34,6 +36,7 @@ import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.controle.BConfigurableComposite; import org.fudaa.ebli.controle.BConfigurableInterface; +import org.fudaa.ebli.controle.BConfigurePalette; import org.fudaa.ebli.controle.BSelecteurAlpha; import org.fudaa.ebli.controle.BSelecteurColorChooser; import org.fudaa.ebli.controle.BSelecteurIconModel; @@ -58,846 +61,974 @@ */ public abstract class EGCourbe extends EGObject { - private int alpha_ = 255; + private int alpha_ = 255; - private final TraceLigneModel lineModel_; + private final TraceLigneModel lineModel_; - private double[] markH_; + // private double[] markH_; - private boolean markMaxLine_; - private boolean markMinLine_; + /** + * la liste des valeurs marquees + */ + private List<EGCourbeMarqueur> listeMarqueurs_=null; - - - private EGModel model_; + private boolean markMaxLine_; - private TraceLigneModel tLigneMarqueur_; + private boolean markMinLine_; - boolean displayTitleOnCurve_; - Font font_ = CtuluLibSwing.getMiniFont(); - final TraceIconModel iconeModel_; + private EGModel model_; - EGCourbeSurfacePainter surfacePainter_; + private TraceLigneModel tLigneMarqueur_; - TraceBox tbox_; + boolean displayTitleOnCurve_; - /** - * @param _model le model a prendre en compte - */ - public EGCourbe(final EGModel _model) { - iconeModel_ = new TraceIconModel(TraceIcon.RIEN, 1, Color.BLACK); - lineModel_ = new TraceLigneModel(); - model_ = _model; - } + Font font_ = CtuluLibSwing.getMiniFont(); - private void buildLigneMarqueur() { - if (tLigneMarqueur_ == null) { - tLigneMarqueur_ = new TraceLigneModel(); - tLigneMarqueur_.setTypeTrait(TraceLigne.POINTILLE); - tLigneMarqueur_.setCouleur(lineModel_.getCouleur().brighter()); - } - } + final TraceIconModel iconeModel_; - private TraceLigne getLineMarkeur() { - buildLigneMarqueur(); - final TraceLigne trMarqueur = new TraceLigne(new TraceLigneModel(tLigneMarqueur_)); - if (EbliLib.isAlphaChanged(alpha_)) { - trMarqueur.setCouleur(EbliLib.getAlphaColor(tLigneMarqueur_.getCouleur(), alpha_)); - } - return trMarqueur; - } + EGCourbeSurfacePainter surfacePainter_; - private void initTraceBox() { - if (tbox_ == null) { - tbox_ = new TraceBox(); - buildLigneMarqueur(); - tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); - tbox_.setColorFond(Color.WHITE); - tbox_.setHMargin(1); - tbox_.setVMargin(1); - tbox_.setHPosition(SwingConstants.LEFT); - tbox_.setVPosition(SwingConstants.CENTER); - tbox_.setColorText(Color.BLACK); - tbox_.setDrawBox(true); - tbox_.setDrawFond(true); - } - } + TraceBox tbox_; - private void traceMarks(final Graphics2D _g, final EGRepere _t) { - final int xmin = _t.getMinEcranX(); - final int xmax = _t.getMaxEcranX(); - final Font f = EGGraphe.DEFAULT_FONT; - final Font old = _g.getFont(); - _g.setFont(f); + /** + * @param _model le model a prendre en compte + */ + public EGCourbe(final EGModel _model) { + iconeModel_ = new TraceIconModel(TraceIcon.RIEN, 1, Color.BLACK); + lineModel_ = new TraceLigneModel(); + model_ = _model; + } - CtuluRange r = null; - TraceLigne trMarqueur = null; - if (isMarkMaxLine() || isMarkMinLine()) { - r = EGCourbeModelDefault.getLocalMinMax(_t.getXAxe(), getModel()); - } - EGAxeVertical axeY = getAxeY(); - if (r != null && isMarkMinLine() && axeY.containsPoint(r.min_)) { - trMarqueur = getLineMarkeur(); - final int yie = _t.getYEcran(r.min_, axeY); - trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); - initTraceBox(); - tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); - int x = xmin + 3; - final String str = axeY.getStringAffiche(r.min_); - if (axeY.isDroite()) { - x = xmax - 6 - _g.getFontMetrics().stringWidth(str); - } - tbox_.paintBox(_g, x, yie, str); + private void buildLigneMarqueur() { + if (tLigneMarqueur_ == null) { + tLigneMarqueur_ = new TraceLigneModel(); + tLigneMarqueur_.setTypeTrait(TraceLigne.POINTILLE); + tLigneMarqueur_.setCouleur(lineModel_.getCouleur().brighter()); + } + } - } - if (r != null && isMarkMaxLine() && axeY.containsPoint(r.max_)) { - if (trMarqueur == null) { - trMarqueur = getLineMarkeur(); - } - final int yie = _t.getYEcran(r.max_, axeY); - trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); - initTraceBox(); - tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); - int x = xmin + 3; - final String str = axeY.getStringAffiche(r.max_); - if (axeY.isDroite()) { - x = xmax - 6 - _g.getFontMetrics().stringWidth(str); - } - tbox_.paintBox(_g, x, yie, str); - } - if (markH_ != null) { - if (trMarqueur == null) { - trMarqueur = getLineMarkeur(); - } - initTraceBox(); - tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); - for (int i = 0; i < markH_.length; i++) { - if (axeY.containsPoint(markH_[i])) { - final int yie = _t.getYEcran(markH_[i], axeY); - int x = xmin + 3; - final String str = axeY.getStringAffiche(markH_[i]); - if (axeY.isDroite()) { - x = xmax - 6 - _g.getFontMetrics().stringWidth(str); - } - trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); - tbox_.paintBox(_g, x, yie, str); - } - } - } + private TraceLigne getLineMarkeur() { + buildLigneMarqueur(); + final TraceLigne trMarqueur = new TraceLigne(new TraceLigneModel(tLigneMarqueur_)); + if (EbliLib.isAlphaChanged(alpha_)) { + trMarqueur.setCouleur(EbliLib.getAlphaColor(tLigneMarqueur_.getCouleur(), alpha_)); + } + return trMarqueur; + } - _g.setFont(old); + private void initTraceBox() { + if (tbox_ == null) { + tbox_ = new TraceBox(); + buildLigneMarqueur(); + tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); + tbox_.setColorFond(Color.WHITE); + tbox_.setHMargin(1); + tbox_.setVMargin(1); + tbox_.setHPosition(SwingConstants.LEFT); + tbox_.setVPosition(SwingConstants.CENTER); + tbox_.setColorText(Color.BLACK); + tbox_.setDrawBox(true); + tbox_.setDrawFond(true); + } + } - } + private void traceMarks(final Graphics2D _g, final EGRepere _t) { + final int xmin = _t.getMinEcranX(); + final int xmax = _t.getMaxEcranX(); + final Font f = EGGraphe.DEFAULT_FONT; + final Font old = _g.getFont(); + _g.setFont(f); - void fillWithInfo(final BPaletteInfo.InfoData _table, final CtuluListSelectionInterface _selectedPt) { - _table.setTitle(EbliLib.getS("Courbe:") + CtuluLibString.ESPACE + getTitle()); - getModel().fillWithInfo(_table, _selectedPt); - _table.put(EbliLib.getS("Nombre de points"), CtuluLibString.getString(model_.getNbValues())); - _table.put(EbliLib.getS("Nombre de points s\xE9lectionn\xE9s"), CtuluLibString.getString(_selectedPt == null ? 0 - : _selectedPt.getNbSelectedIndex())); - _table.put(EbliLib.getS("X min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMin())); - _table.put(EbliLib.getS("X max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMax())); - _table.put(EbliLib.getS("Y min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMin())); - _table.put(EbliLib.getS("Y max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMax())); - - } + CtuluRange r = null; + TraceLigne trMarqueur = null; + if (isMarkMaxLine() || isMarkMinLine()) { + r = EGCourbeModelDefault.getLocalMinMax(_t.getXAxe(), getModel()); + } + EGAxeVertical axeY = getAxeY(); + if (r != null && isMarkMinLine() && axeY.containsPoint(r.min_)) { + trMarqueur = getLineMarkeur(); + final int yie = _t.getYEcran(r.min_, axeY); + trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); + initTraceBox(); + tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); + int x = xmin + 3; + final String str = axeY.getStringAffiche(r.min_); + if (axeY.isDroite()) { + x = xmax - 6 - _g.getFontMetrics().stringWidth(str); + } + tbox_.paintBox(_g, x, yie, str); - final boolean isMarkMaxLine() { - return markMaxLine_; - } + } + if (r != null && isMarkMaxLine() && axeY.containsPoint(r.max_)) { + if (trMarqueur == null) { + trMarqueur = getLineMarkeur(); + } + final int yie = _t.getYEcran(r.max_, axeY); + trMarqueur.dessineTrait(_g, xmin, yie, xmax, yie); + initTraceBox(); + tbox_.setColorBoite(tLigneMarqueur_.getCouleur()); + int x = xmin + 3; + final String str = axeY.getStringAffiche(r.max_); + if (axeY.isDroite()) { + x = xmax - 6 - _g.getFontMetrics().stringWidth(str); + } + tbox_.paintBox(_g, x, yie, str); + } + if (getMarqueurs() != null) { +// if (trMarqueur == null) { +// trMarqueur = getLineMarkeur(); +// } + initTraceBox(); - final boolean isMarkMinLine() { - return markMinLine_; - } - boolean setLigneType(final TraceLigneModel _data) { - final boolean res = lineModel_.updateData(_data); - if (res) { - fireCourbeAspectChanged(false); - super.firePropertyChange(BSelecteurLineModel.PROPERTY, null, lineModel_); - } - return res; - } - final boolean setMarkMaxLine(final boolean _markMaxLine) { - if (_markMaxLine != markMaxLine_) { - markMaxLine_ = _markMaxLine; - fireCourbeAspectChanged(false); - firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_MAX, markMaxLine_); - return true; - } - return false; - } - final boolean setMarkMinLine(final boolean _markMinLine) { - if (markMinLine_ != _markMinLine) { - markMinLine_ = _markMinLine; - fireCourbeAspectChanged(false); - firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_MIN, markMinLine_); - return true; - } - return false; - } + for (EGCourbeMarqueur marqueur:getMarqueurs()) { + tbox_.setColorBoite(marqueur.model_.getCouleur()); - protected int getAlpha() { - return alpha_; - } + if (axeY.containsPoint(marqueur.getValue()) && marqueur.isVisible()) { + final int yie = _t.getYEcran(marqueur.getValue(), axeY); + int x = xmin + 3; + final String str = axeY.getStringAffiche(marqueur.getValue()); + if (axeY.isDroite()) { + x = xmax - 6 - _g.getFontMetrics().stringWidth(str); + } + new TraceLigne(marqueur.model_).dessineTrait(_g, xmin, yie, xmax, yie); + tbox_.paintBox(_g, x, yie, str); + } + } + } - protected abstract EGParent getEGParent(); - - public abstract EGCourbe duplicate(EGParent newParent,EGGrapheDuplicator _duplicator); + _g.setFont(old); - protected Font getFont() { - return font_; - } + } - protected boolean isDisplayTitleOnCurve() { - return displayTitleOnCurve_; - } + void fillWithInfo(final BPaletteInfo.InfoData _table, final CtuluListSelectionInterface _selectedPt) { + _table.setTitle(EbliLib.getS("Courbe:") + CtuluLibString.ESPACE + getTitle()); + getModel().fillWithInfo(_table, _selectedPt); + _table.put(EbliLib.getS("Nombre de points"), CtuluLibString.getString(model_.getNbValues())); + _table.put(EbliLib.getS("Nombre de points s\xE9lectionn\xE9s"), CtuluLibString.getString(_selectedPt == null ? 0 + : _selectedPt.getNbSelectedIndex())); + _table.put(EbliLib.getS("X min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMin())); + _table.put(EbliLib.getS("X max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getXMax())); + _table.put(EbliLib.getS("Y min"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMin())); + _table.put(EbliLib.getS("Y max"), CtuluLib.DEFAULT_NUMBER_FORMAT.format(model_.getYMax())); - protected boolean isSelected(final double _xToTest, final double _yToTest, final int _x, final int _y, - final EGRepere _t, final EGAxeVertical _yaxe, final int _precision) { - return (CtuluLibGeometrie.getDistance(_x, _y, _t.getXEcran(_xToTest), _t.getYEcran(_yToTest, _yaxe)) <= _precision); - } + } - protected void paintSurface(final Graphics2D _g, final EGRepere _t, final int _i) { - createSurface(); - if (surfacePainter_ != null) { - surfacePainter_.paint(_g, _t, _i); - } - } + final boolean isMarkMaxLine() { + return markMaxLine_; + } - protected boolean setAlpha(final int _alpha) { - if (alpha_ != _alpha) { - alpha_ = _alpha; - firePropertyChange(BSelecteurAlpha.DEFAULT_PROPERTY); - fireCourbeAspectChanged(false); - return true; - } - return false; - } + final boolean isMarkMinLine() { + return markMinLine_; + } - protected boolean setDisplayTitleOnCurve(final boolean _displayTitleOnCurve) { - if (_displayTitleOnCurve == displayTitleOnCurve_) { - return false; - } - displayTitleOnCurve_ = _displayTitleOnCurve; - fireCourbeAspectChanged(false); - firePropertyChange(EGCourbeConfigureTarget.PROP_DISPLAY_TITLE_CURVE, displayTitleOnCurve_); - return true; - } + boolean setLigneType(final TraceLigneModel _data) { + final boolean res = lineModel_.updateData(_data); + if (res) { + fireCourbeAspectChanged(false); + super.firePropertyChange(BSelecteurLineModel.PROPERTY, null, lineModel_); + } + return res; + } - protected boolean setFont(final Font _font) { - if (_font == font_) { - return false; - } - font_ = _font; - fireCourbeAspectChanged(false); - firePropertyChange(BSelecteurReduitFonteNewVersion.PROPERTY); - return true; - } + final boolean setMarkMaxLine(final boolean _markMaxLine) { + if (_markMaxLine != markMaxLine_) { + markMaxLine_ = _markMaxLine; + fireCourbeAspectChanged(false); + firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_MAX, markMaxLine_); + return true; + } + return false; + } - protected void traceTitle(final Graphics2D _g, final EGRepere _t, final Envelope _r) { - if (_r == null) { - return; - } - final double x = _r.getMinX(); - double y = interpol(x); - final Font old = _g.getFont(); - _g.setFont(getFont()); - final FontMetrics fm = _g.getFontMetrics(); - final String title = getTitle(); - final int xie = _t.getXEcran(x); - final int xlast = xie + fm.stringWidth(title); - final double xLastReal = _t.getXReel(xlast); - final TIntArrayList l = new TIntArrayList(getModel().getNbValues()); - fillWithIdxStrictlyIncluded(Math.floor(x), Math.ceil(xLastReal), l); - for (int i = l.size() - 1; i >= 0; i--) { - final double yi = getModel().getY(l.get(i)); - if (yi > y) { - y = yi; - } - } - final int yie = _t.getYEcran(y, getAxeY()) - fm.getHeight(); - _g.drawString(title, xie, yie); - _g.setFont(old); - } + final boolean setMarkMinLine(final boolean _markMinLine) { + if (markMinLine_ != _markMinLine) { + markMinLine_ = _markMinLine; + fireCourbeAspectChanged(false); + firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_MIN, markMinLine_); + return true; + } + return false; + } - public boolean ajuste(final CtuluRange _x, final CtuluRange _y) { - //un seul | pout ajuster les 2 - return ajusteX(_x) | ajusteY(_y); - } + protected int getAlpha() { + return alpha_; + } - public boolean ajusteX(final CtuluRange _r) { - double x = getXMin(); - boolean r = false; - final boolean mustChange = _r.isNill(); - if (mustChange || x < _r.min_) { - r = true; - _r.min_ = x; - } - x = getXMax(); - if (mustChange || x > _r.max_) { - r = true; - _r.max_ = x; - } - return r; - } + protected abstract EGParent getEGParent(); - public boolean ajusteY(final CtuluRange _r) { - boolean r = false; - double y = getYMin(); - final boolean mustChange = _r.isNill(); - if (mustChange || y < _r.min_) { - r = true; - _r.min_ = y; - } - y = getYMax(); - if (mustChange || y > _r.max_) { - r = true; - _r.max_ = y; - } - return r; - } + public abstract EGCourbe duplicate(EGParent newParent,EGGrapheDuplicator _duplicator); - /** - * @param _x le x a tester - * @return true si afficher - */ - public boolean containsX(final double _x) { - return (_x <= getModel().getXMax()) && (_x >= getModel().getXMin()); - } + protected Font getFont() { + return font_; + } - public void createSurface() { - if (surfacePainter_ == null && getEGParent() != null) { - surfacePainter_ = new EGCourbeSurfacePainter(this, getEGParent().getMainModel()); - } - } + protected boolean isDisplayTitleOnCurve() { + return displayTitleOnCurve_; + } - public void descendre() { - getEGParent().descendre(this); - } + protected boolean isSelected(final double _xToTest, final double _yToTest, final int _x, final int _y, + final EGRepere _t, final EGAxeVertical _yaxe, final int _precision) { + return (CtuluLibGeometrie.getDistance(_x, _y, _t.getXEcran(_xToTest), _t.getYEcran(_yToTest, _yaxe)) <= _precision); + } - /** - * Boolean si oui ou non le graphe est un nuage de points - */ - protected boolean nuagePoints_=false; - /** - * Taille des points du nuages symbolis\xE9s par des carr\xE9s. - */ - protected int largeurPointsNuage_=5; - - public void dessine(final Graphics2D _g, final EGRepere _t) { - if (!isVisible_) { - return; - } - if (model_.getNbValues() == 0) { - return; - } - final Shape oldClip = _g.getClip(); - final int minX = _t.getMinEcranX(); - final int adjust = 3; - _g.setClip(minX - adjust, 0, _t.getMaxEcranX() - minX + adjust * 2, _t.getH()); - final int nbPt = model_.getNbValues(); - double xi, yi, xie, yie; - boolean xiVisible; - boolean yiVisible; - double xpe = 0; - double ype = 0; - boolean xpVisible = false; - Envelope rangeDisplayed = null; - _g.setColor(EbliLib.getAlphaColor(getAspectContour(), alpha_)); - final boolean isAlphaChanged = EbliLib.isAlphaChanged(alpha_); - final TraceIcon trIcon = new TraceIcon(isAlphaChanged ? new TraceIconModel(iconeModel_) : iconeModel_); - final TraceLigne trLigne = new TraceLigne(isAlphaChanged ? new TraceLigneModel(lineModel_) : lineModel_); - if (isAlphaChanged) { - trIcon.setCouleur(EbliLib.getAlphaColor(trIcon.getCouleur(), alpha_)); - trLigne.setCouleur(EbliLib.getAlphaColor(trLigne.getCouleur(), alpha_)); - } - for (int i = 0; i < nbPt; i++) { - xi = model_.getX(i); - yi = model_.getY(i); - xie = _t.getXEcran(xi); - yie = _t.getYEcran(yi, getAxeY()); - xiVisible = _t.getXAxe().containsPoint(xi); - yiVisible = getAxeY().containsPoint(yi); + protected void paintSurface(final Graphics2D _g, final EGRepere _t, final int _i) { + createSurface(); + if (surfacePainter_ != null) { + surfacePainter_.paint(_g, _t, _i); + } + } - if (model_.isPointDrawn(i) && xiVisible && yiVisible && iconeModel_.getType() != TraceIcon.RIEN) { - if (displayTitleOnCurve_) { - if (rangeDisplayed == null) { - rangeDisplayed = new Envelope(); - } - rangeDisplayed.expandToInclude(xi, yi); - } - // icone_.couleur(getAspectContour()); - trIcon.paintIconCentre(_g, xie, yie); - } - if ((i > 0) && model_.isSegmentDrawn(i - 1) && (xpVisible || xiVisible || _t.getXAxe().isContained(xpe, xie))) { - if (displayTitleOnCurve_) { - if (rangeDisplayed == null) { - rangeDisplayed = new Envelope(); - } - rangeDisplayed.expandToInclude(xi, yi); - } - paintSurface(_g, _t, i); - - if(!nuagePoints_) - trLigne.dessineTrait(_g, xie, yie, xpe, ype); - else{ - //-- trace un + --// - //-- ligne | --// - trLigne.dessineTrait(_g, xie, yie-largeurPointsNuage_/2, xie, yie+largeurPointsNuage_/2); - //--ligne - --// - trLigne.dessineTrait(_g, xie-largeurPointsNuage_/2, yie, xie+largeurPointsNuage_/2, yie); - //dessineRectangle(_g, xie-largeurPointsNuage_/2, yie-largeurPointsNuage_/2, largeurPointsNuage_, largeurPointsNuage_); - } - } - xpVisible = xiVisible; - xpe = xie; - ype = yie; - } - _g.setClip(oldClip); - traceMarks(_g, _t); - traceTitle(_g, _t, rangeDisplayed); - } + protected boolean setAlpha(final int _alpha) { + if (alpha_ != _alpha) { + alpha_ = _alpha; + firePropertyChange(BSelecteurAlpha.DEFAULT_PROPERTY); + fireCourbeAspectChanged(false); + return true; + } + return false; + } - public boolean isNuagePoints_() { - return nuagePoints_; -} + protected boolean setDisplayTitleOnCurve(final boolean _displayTitleOnCurve) { + if (_displayTitleOnCurve == displayTitleOnCurve_) { + return false; + } + displayTitleOnCurve_ = _displayTitleOnCurve; + fireCourbeAspectChanged(false); + firePropertyChange(EGCourbeConfigureTarget.PROP_DISPLAY_TITLE_CURVE, displayTitleOnCurve_); + return true; + } -public void setNuagePoints_(boolean nuagePoints_) { - this.nuagePoints_ = nuagePoints_; -} + protected boolean setFont(final Font _font) { + if (_font == font_) { + return false; + } + font_ = _font; + fireCourbeAspectChanged(false); + firePropertyChange(BSelecteurReduitFonteNewVersion.PROPERTY); + return true; + } -public void enDernier() { - getEGParent().enDernier(this); + protected void traceTitle(final Graphics2D _g, final EGRepere _t, final Envelope _r) { + if (_r == null) { + return; + } + final double x = _r.getMinX(); + double y = interpol(x); + final Font old = _g.getFont(); + _g.setFont(getFont()); + final FontMetrics fm = _g.getFontMetrics(); + final String title = getTitle(); + final int xie = _t.getXEcran(x); + final int xlast = xie + fm.stringWidth(title); + final double xLastReal = _t.getXReel(xlast); + final TIntArrayList l = new TIntArrayList(getModel().getNbValues()); + fillWithIdxStrictlyIncluded(Math.floor(x), Math.ceil(xLastReal), l); + for (int i = l.size() - 1; i >= 0; i--) { + final double yi = getModel().getY(l.get(i)); + if (yi > y) { + y = yi; + } + } + final int yie = _t.getYEcran(y, getAxeY()) - fm.getHeight(); + _g.drawString(title, xie, yie); + _g.setFont(old); + } - } + public boolean ajuste(final CtuluRange _x, final CtuluRange _y) { + //un seul | pout ajuster les 2 + return ajusteX(_x) | ajusteY(_y); + } - public void enPremier() { - getEGParent().enPremier(this); - } + public boolean ajusteX(final CtuluRange _r) { + double x = getXMin(); + boolean r = false; + final boolean mustChange = _r.isNill(); + if (mustChange || x < _r.min_) { + r = true; + _r.min_ = x; + } + x = getXMax(); + if (mustChange || x > _r.max_) { + r = true; + _r.max_ = x; + } + return r; + } - public void fillWithCurves(final List _dest) { - _dest.add(this); - } + public boolean ajusteY(final CtuluRange _r) { + boolean r = false; + double y = getYMin(); + final boolean mustChange = _r.isNill(); + if (mustChange || y < _r.min_) { + r = true; + _r.min_ = y; + } + y = getYMax(); + if (mustChange || y > _r.max_) { + r = true; + _r.max_ = y; + } + return r; + } - /** - * @param _xDeb l'abscisse de deb - * @param _xEnd l'abscisse de deb - * @param _dest la liste qui sera remplie avec les indices des points dont les abscisses sont strictement incluses - * dans ]_xDeb,_xEnd[ - */ - public void fillWithIdxStrictlyIncluded(final double _xDeb, final double _xEnd, final TIntArrayList _dest) { - _dest.clear(); - if (getModel().getNbValues() == 0) { - return; - } - int idx = getNearestIdx(_xDeb); - if (idx < 0) { - idx = -idx - 1; - } else { - idx++; - } - if (idx < 0 || idx >= getModel().getNbValues()) { - return; - } - double x = getModel().getX(idx); - while (x > _xDeb && x < _xEnd) { - _dest.add(idx); - idx++; - if (idx >= getModel().getNbValues()) { - break; - } - x = getModel().getX(idx); + /** + * @param _x le x a tester + * @return true si afficher + */ + public boolean containsX(final double _x) { + return (_x <= getModel().getXMax()) && (_x >= getModel().getXMin()); + } - } - } + public void createSurface() { + if (surfacePainter_ == null && getEGParent() != null) { + surfacePainter_ = new EGCourbeSurfacePainter(this, getEGParent().getMainModel()); + } + } - public final void fireCourbeAspectChanged(final boolean _visibility) { - if (getEGParent() != null) { - getEGParent().fireCourbeAspectChanged(this, _visibility); - } - } + public void descendre() { + getEGParent().descendre(this); + } - public final void fireCourbeContentChanged() { - if (getEGParent() != null) { - getEGParent().fireCourbeContentChanged(this, false); - } + /** + * Boolean si oui ou non le graphe est un nuage de points + */ + protected boolean nuagePoints_=false; + /** + * Taille des points du nuages symbolis\xE9s par des carr\xE9s. + */ + protected int largeurPointsNuage_=5; - } + public void dessine(final Graphics2D _g, final EGRepere _t) { + if (!isVisible_) { + return; + } + if (model_.getNbValues() == 0) { + return; + } + final Shape oldClip = _g.getClip(); + final int minX = _t.getMinEcranX(); + final int adjust = 3; + _g.setClip(minX - adjust, 0, _t.getMaxEcranX() - minX + adjust * 2, _t.getH()); + final int nbPt = model_.getNbValues(); + double xi, yi, xie, yie; + boolean xiVisible; + boolean yiVisible; + double xpe = 0; + double ype = 0; + boolean xpVisible = false; + Envelope rangeDisplayed = null; + _g.setColor(EbliLib.getAlphaColor(getAspectContour(), alpha_)); + final boolean isAlphaChanged = EbliLib.isAlphaChanged(alpha_); + final TraceIcon trIcon = new TraceIcon(isAlphaChanged ? new TraceIconModel(iconeModel_) : iconeModel_); + final TraceLigne trLigne = new TraceLigne(isAlphaChanged ? new TraceLigneModel(lineModel_) : lineModel_); + if (isAlphaChanged) { + trIcon.setCouleur(EbliLib.getAlphaColor(trIcon.getCouleur(), alpha_)); + trLigne.setCouleur(EbliLib.getAlphaColor(trLigne.getCouleur(), alpha_)); + } + for (int i = 0; i < nbPt; i++) { + xi = model_.getX(i); + yi = model_.getY(i); + xie = _t.getXEcran(xi); + yie = _t.getYEcran(yi, getAxeY()); + xiVisible = _t.getXAxe().containsPoint(xi); + yiVisible = getAxeY().containsPoint(yi); - /** - * @return un indice entre 0 et le nombre de point indiquant l'indice active( un pas de temps par exemple) - */ - public int getActiveTimeIdx() { - return -1; - } + if (model_.isPointDrawn(i) && xiVisible && yiVisible && iconeModel_.getType() != TraceIcon.RIEN) { + if (displayTitleOnCurve_) { + if (rangeDisplayed == null) { + rangeDisplayed = new Envelope(); + } + rangeDisplayed.expandToInclude(xi, yi); + } + // icone_.couleur(getAspectContour()); + trIcon.paintIconCentre(_g, xie, yie); + } + if ((i > 0) && model_.isSegmentDrawn(i - 1) && (xpVisible || xiVisible || _t.getXAxe().isContained(xpe, xie))) { + if (displayTitleOnCurve_) { + if (rangeDisplayed == null) { + rangeDisplayed = new Envelope(); + } + rangeDisplayed.expandToInclude(xi, yi); + } + paintSurface(_g, _t, i); - public boolean getAllowsChildren() { - return false; - } + if(!nuagePoints_) + trLigne.dessineTrait(_g, xie, yie, xpe, ype); + else{ + //-- trace un + --// + //-- ligne | --// + trLigne.dessineTrait(_g, xie, yie-largeurPointsNuage_/2, xie, yie+largeurPointsNuage_/2); + //--ligne - --// + trLigne.dessineTrait(_g, xie-largeurPointsNuage_/2, yie, xie+largeurPointsNuage_/2, yie); + //dessineRectangle(_g, xie-largeurPointsNuage_/2, yie-largeurPointsNuage_/2, largeurPointsNuage_, largeurPointsNuage_); + } + } + xpVisible = xiVisible; + xpe = xie; + ype = yie; + } + _g.setClip(oldClip); + traceMarks(_g, _t); + traceTitle(_g, _t, rangeDisplayed); + } - public Color getAspectContour() { - final Color c = lineModel_.getCouleur(); - return c == iconeModel_.getCouleur() ? c : null; - } + public boolean isNuagePoints_() { + return nuagePoints_; + } - public Color getAspectSurface() { - return null; - } + public void setNuagePoints_(boolean nuagePoints_) { + this.nuagePoints_ = nuagePoints_; + } - public Color getAspectTexte() { - return null; - } + public boolean setNuagePointEtApplique(boolean nuagePOints){ + setNuagePoints_(nuagePoints_); + fireCourbeAspectChanged(false); + //fireCourbeContentChanged(); + return true; + + } + + public void enDernier() { + getEGParent().enDernier(this); - public final EGAxeHorizontal getAxeX() { - return getEGParent().getAxeX(); - } + } - public BConfigurableInterface[] getConfigureInterfaces() { - return new BConfigurableInterface[] { getSingleConfigureInterface() }; - } + public void enPremier() { + getEGParent().enPremier(this); + } - public int getIconeType() { - return iconeModel_.getType(); - } + public void fillWithCurves(final List _dest) { + _dest.add(this); + } - public int getIconHeight() { - return 24; - } + /** + * @param _xDeb l'abscisse de deb + * @param _xEnd l'abscisse de deb + * @param _dest la liste qui sera remplie avec les indices des points dont les abscisses sont strictement incluses + * dans ]_xDeb,_xEnd[ + */ + public void fillWithIdxStrictlyIncluded(final double _xDeb, final double _xEnd, final TIntArrayList _dest) { + _dest.clear(); + if (getModel().getNbValues() == 0) { + return; + } + int idx = getNearestIdx(_xDeb); + if (idx < 0) { + idx = -idx - 1; + } else { + idx++; + } + if (idx < 0 || idx >= getModel().getNbValues()) { + return; + } + double x = getModel().getX(idx); + while (x > _xDeb && x < _xEnd) { + _dest.add(idx); + idx++; + if (idx >= getModel().getNbValues()) { + break; + } + x = getModel().getX(idx); - public TraceIconModel getIconModel() { - return iconeModel_; - } + } + } - public int getIconWidth() { - return 24; - } + public final void fireCourbeAspectChanged(final boolean _visibility) { + if (getEGParent() != null) { + getEGParent().fireCourbeAspectChanged(this, _visibility); + } + } - public int getIndex(final TreeNode _node) { - return -1; - } + public final void fireCourbeContentChanged() { + if (getEGParent() != null) { + getEGParent().fireCourbeContentChanged(this, false); + } - public TraceLigneModel getLigneModel() { - return lineModel_; - } + } - public TraceLigneModel getMarkLigneModel() { - return tLigneMarqueur_; - } + /** + * @return un indice entre 0 et le nombre de point indiquant l'indice active( un pas de temps par exemple) + */ + public int getActiveTimeIdx() { + return -1; + } - /** - * @return les marques affichees par cette courbe - */ - public double[] getMarks() { - return CtuluLibArray.copy(markH_); + public boolean getAllowsChildren() { + return false; + } - } + public Color getAspectContour() { + final Color c = lineModel_.getCouleur(); + return c == iconeModel_.getCouleur() ? c : null; + } - public EGModel getModel() { - return model_; - } + public Color getAspectSurface() { + return null; + } - public int getNearestIdx(final double _x) { - int low = 0; - int high = model_.getNbValues() - 1; - while (low <= high) { - final int mid = (low + high) >> 1; - final double midVal = getModel().getX(mid); - if (midVal < _x) { - low = mid + 1; - } else if (midVal > _x) { - high = mid - 1; - } else { - return mid; // value found - } - } - return -(low + 1); // value not found. + public Color getAspectTexte() { + return null; + } - } + public final EGAxeHorizontal getAxeX() { + return getEGParent().getAxeX(); + } - public BConfigurableInterface getSingleConfigureInterface() { - BConfigurableComposite aff = null; - if (surfacePainter_ == null) { - aff = new BConfigurableComposite(new EGCourbeConfigureTarget.Display(this), EbliLib - .getS("Courbes")); - } else { - aff = new BConfigurableComposite(new EGCourbeConfigureTarget.Display(this), new EGCourbeSurfacePainterConfigure( - surfacePainter_), EbliLib.getS("Courbes")); - } - final BConfigurableComposite axeY = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(getAxeY(), - getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeY(), getEGParent()), EbliLib - .getS("Axes verticaux")); - final BConfigurableComposite axeX = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(getAxeX(), - getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeX(), getEGParent()), EbliLib - .getS("Axe horizontal")); - return new BConfigurableComposite(aff, new EGCourbeConfigureTarget.Marks(this), axeY, axeX, null); - } + public BConfigurableInterface[] getConfigureInterfaces() { + return new BConfigurableInterface[] { getSingleConfigureInterface() }; + } - public EGCourbeSurfacePainter getSurfacePainter() { - return surfacePainter_; - } + public int getIconeType() { + return iconeModel_.getType(); + } - public String getTitle() { - return model_.getTitle(); - } + public int getIconHeight() { + return 24; + } - public double getXMax() { - return model_.getXMax(); - } + public TraceIconModel getIconModel() { + return iconeModel_; + } - public double getXMin() { - return model_.getXMin(); - } + public int getIconWidth() { + return 24; + } - public double getYMax() { - return model_.getYMax(); - } + public int getIndex(final TreeNode _node) { + return -1; + } - public double getYMin() { - return model_.getYMin(); - } + public TraceLigneModel getLigneModel() { + return lineModel_; + } - public double interpol(final double _x) { - final int i = getNearestIdx(_x); - if (i >= 0) { - return model_.getY(i); - } - final int idx = -i - 2; - if ((idx < 0) || (idx >= model_.getNbValues() - 1)) { - return 0D; - } - final double xlow = model_.getX(idx); - final double xup = model_.getX(idx + 1); - final double ylow = model_.getY(idx); - final double yup = model_.getY(idx + 1); - return yup - (xup - _x) / (xup - xlow) * (yup - ylow); - } + public TraceLigneModel getMarkLigneModel() { + return tLigneMarqueur_; + } - public double interpolOnEcran(final double _x, final EGRepere _rep) { - if (model_.getNbValues() == 0) { - return 0d; - } - final EGAxeVertical vert = getAxeY(); - final int i = getNearestIdx(_x); - if (i >= 0) { - return _rep.getYEcran(model_.getY(i), vert); - } - final int idx = -i - 2; - if (model_.getNbValues() == 0) { - return 0d; - } - if (idx < 0) { - return _rep.getYEcran(model_.getY(0), vert); - } - if (idx >= model_.getNbValues() - 1) { - return _rep.getYEcran(model_.getY(model_.getNbValues() - 1), vert); - } - final double xlow = _rep.getXEcran(model_.getX(idx)); - final double xup = _rep.getXEcran(model_.getX(idx + 1)); - final double ylow = _rep.getYEcran(model_.getY(idx), vert); - final double yup = _rep.getYEcran(model_.getY(idx + 1), vert); - return yup - (xup - _rep.getXEcran(_x)) / (xup - xlow) * (yup - ylow); - } - public boolean isActiveTimeEnable() { - return false; - } +// public double[] getMarks() { +// return CtuluLibArray.copy(markH_); - public final boolean isCourbe() { - return true; - } +// } + /** + * @return les marques affichees par cette courbe + */ + public List<EGCourbeMarqueur> getMarqueurs() { + if(listeMarqueurs_==null){ + //-- init avec 3 marqueurs --// + listeMarqueurs_=new ArrayList<EGCourbeMarqueur>(3); + addMarqueur(); + addMarqueur(); + addMarqueur(); + } + return listeMarqueurs_; - /** - * @return true - */ - public final boolean isLegendAvailable() { - return true; - } + } + public EGModel getModel() { + return model_; + } - public boolean isSomethingToDisplay() { - return true; - } + public int getNearestIdx(final double _x) { + int low = 0; + int high = model_.getNbValues() - 1; + while (low <= high) { + final int mid = (low + high) >> 1; + final double midVal = getModel().getX(mid); + if (midVal < _x) { + low = mid + 1; + } else if (midVal > _x) { + high = mid - 1; + } else { + return mid; // value found + } + } + return -(low + 1); // value not found. - public boolean isTitleModifiable() { - return model_.isTitleModifiable(); - } + } - public void monter() { - getEGParent().monter(this); - } + public BConfigurableInterface getSingleConfigureInterface() { + BConfigurableComposite aff = null; + if (surfacePainter_ == null) { + aff = new BConfigurableComposite(new EGCourbeConfigureTarget.Display(this), EbliLib + .getS("Courbes")); + } else { + aff = new BConfigurableComposite(new EGCourbeConfigureTarget.Display(this), new EGCourbeSurfacePainterConfigure( + surfacePainter_), EbliLib.getS("Courbes")); + } + final BConfigurableComposite axeY = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(getAxeY(), + getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeY(), getEGParent()), EbliLib + .getS("Axes verticaux")); + final BConfigurableComposite axeX = new BConfigurableComposite(new EGAxeConfigureTarget.AffichageConfigurator(getAxeX(), + getEGParent()), new EGAxeConfigureTarget.TitleConfigure(getAxeX(), getEGParent()), EbliLib + .getS("Axe horizontal")); + return new BConfigurableComposite(aff, new EGCourbeConfigureTarget.Marks(this), axeY, axeX, null); + } - public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { - Color c = getAspectContour(); - if (!isVisible()) { - c = FiltreAttenuation.attenueCouleur(c); - } - final Color o = _g.getColor(); - final Graphics2D g = (Graphics2D) _g; - final Stroke oldS = g.getStroke(); - g.setStroke(new BasicStroke(1.5f)); - _g.setColor(c); - int xinit = _x; - int yinit = _y; - final int w4 = getIconWidth() / 4; - final int h = getIconWidth(); - int xfin = xinit + w4; - int yfin = yinit + h / 4; - _g.drawLine(xinit, yinit, xfin, yfin); - xinit = xfin; - yinit = yfin; - xfin += w4; - yfin = _y; - _g.drawLine(xinit, yinit, xfin, yfin); - xinit = xfin; - yinit = yfin; - xfin += w4; - yfin = _y + h; - _g.drawLine(xinit, yinit, xfin, yfin); - xinit = xfin; - yinit = yfin; - xfin += w4; - yfin = _y + h / 2; - _g.drawLine(xinit, yinit, xfin, yfin); - _g.setColor(o); - g.setStroke(oldS); - } + public EGCourbeSurfacePainter getSurfacePainter() { + return surfacePainter_; + } - public void paintSelection(final Graphics2D _g2d, final EGInteractionSelection _d) { - final CtuluListSelectionInterface s = _d.getSelection(); - for (int i = s.getMaxIndex(); i >= s.getMinIndex(); i--) { - if (s.isSelected(i) && i < model_.getNbValues()) { - final int x = _d.getRepere().getXEcran(model_.getX(i)); - final int y = _d.getRepere().getYEcran(model_.getY(i), getAxeY()); - _d.getSelectionIcone().paintIconCentre(_g2d, x, y); - } - } - } + public String getTitle() { + return model_.getTitle(); + } - public void removePropertyChangeListener(final PropertyChangeListener _l) {} + public double getXMax() { + return model_.getXMax(); + } - public int select(final int _xEcran, final int _yEcran, final EGRepere _repere, final int _prec) { - if (model_.getNbValues() == 0) { - return -1; - } - final double x = _repere.getXReel(_xEcran); - int idx = getNearestIdx(x); - if (idx >= 0) { - final boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); - if (r) { - return idx; - } - } - idx = -idx - 2; - final int maxIdx = model_.getNbValues() - 1; - if (idx < 0) { - idx = 0; - } - if (idx > maxIdx) { - idx = maxIdx; - } - boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); - if (r) { - return idx; - } - if (idx < maxIdx) { - idx++; - r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); - if (r) { - return idx; - } - } - return -1; - } + public double getXMin() { + return model_.getXMin(); + } - public boolean setAspectContour(final Color _c) { - if (_c == null) { - return false; - } - boolean r = false; - if (!_c.equals(lineModel_.getCouleur())) { - lineModel_.setCouleur(_c); - firePropertyChange(BSelecteurLineModel.PROPERTY); - r = true; - } - if (!iconeModel_.getCouleur().equals(_c)) { - iconeModel_.setCouleur(_c); - firePropertyChange(BSelecteurIconModel.DEFAULT_PROPERTY); - r = true; - } - if (r) { - fireCourbeAspectChanged(false); - firePropertyChange(BSelecteurColorChooser.DEFAULT_PROPERTY, null, _c); - } - return r; - } + public double getYMax() { + return model_.getYMax(); + } - public boolean setIconeModel(final TraceIconModel _ic) { - final boolean r = iconeModel_.updateData(_ic); - if (r) { - fireCourbeAspectChanged(false); - super.firePropertyChange(BSelecteurIconModel.DEFAULT_PROPERTY, null, iconeModel_); - } - return r; - } + public double getYMin() { + return model_.getYMin(); + } - public boolean setLigneMark(final TraceLigneModel _data) { - if (tLigneMarqueur_ == null) { - buildLigneMarqueur(); - } - final boolean res = tLigneMarqueur_.updateData(_data); - if (res) { - fireCourbeAspectChanged(false); - super.firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_LINE, null, iconeModel_); - } - return res; - } + public double interpol(final double _x) { + final int i = getNearestIdx(_x); + if (i >= 0) { + return model_.getY(i); + } + final int idx = -i - 2; + if ((idx < 0) || (idx >= model_.getNbValues() - 1)) { + return 0D; + } + final double xlow = model_.getX(idx); + final double xup = model_.getX(idx + 1); + final double ylow = model_.getY(idx); + final double yup = model_.getY(idx + 1); + return yup - (xup - _x) / (xup - xlow) * (yup - ylow); + } - /** - * @param _marks les nouvelles marques - * @return true si modife - */ - public boolean setMarks(final double[] _marks) { - if (Arrays.equals(markH_, _marks)) { - return false; - } - markH_ = CtuluLibArray.copy(_marks); - fireCourbeAspectChanged(false); - firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_VALUES, null, _marks); - return true; - } + public double interpolOnEcran(final double _x, final EGRepere _rep) { + if (model_.getNbValues() == 0) { + return 0d; + } + final EGAxeVertical vert = getAxeY(); + final int i = getNearestIdx(_x); + if (i >= 0) { + return _rep.getYEcran(model_.getY(i), vert); + } + final int idx = -i - 2; + if (model_.getNbValues() == 0) { + return 0d; + } + if (idx < 0) { + return _rep.getYEcran(model_.getY(0), vert); + } + if (idx >= model_.getNbValues() - 1) { + return _rep.getYEcran(model_.getY(model_.getNbValues() - 1), vert); + } + final double xlow = _rep.getXEcran(model_.getX(idx)); + final double xup = _rep.getXEcran(model_.getX(idx + 1)); + final double ylow = _rep.getYEcran(model_.getY(idx), vert); + final double yup = _rep.getYEcran(model_.getY(idx + 1), vert); + return yup - (xup - _rep.getXEcran(_x)) / (xup - xlow) * (yup - ylow); + } - public void setModel(final EGModel _model) { - model_ = _model; - } + public boolean isActiveTimeEnable() { + return false; + } - public boolean setTitle(final String _newTitle) { - final boolean res = model_.setTitle(_newTitle); - if (res) { - fireCourbeContentChanged(); - firePropertyChange(BSelecteurTextField.TITLE_PROPERTY, null, model_.getTitle()); - } - return res; - } + public final boolean isCourbe() { + return true; + } - public String toString() { - return getTitle(); - } + /** + * @return true + */ + public final boolean isLegendAvailable() { + return true; + } -public TraceBox getTbox_() { - return tbox_; -} + public boolean isSomethingToDisplay() { + return true; + } -public void setTbox_(TraceBox tbox_) { - this.tbox_ = tbox_; -} - - - - + public boolean isTitleModifiable() { + return model_.isTitleModifiable(); + } + public void monter() { + getEGParent().monter(this); + } + + public void paintIcon(final Component _c, final Graphics _g, final int _x, final int _y) { + Color c = getAspectContour(); + if (!isVisible()) { + c = FiltreAttenuation.attenueCouleur(c); + } + final Color o = _g.getColor(); + final Graphics2D g = (Graphics2D) _g; + final Stroke oldS = g.getStroke(); + g.setStroke(new BasicStroke(1.5f)); + _g.setColor(c); + int xinit = _x; + int yinit = _y; + final int w4 = getIconWidth() / 4; + final int h = getIconWidth(); + int xfin = xinit + w4; + int yfin = yinit + h / 4; + _g.drawLine(xinit, yinit, xfin, yfin); + xinit = xfin; + yinit = yfin; + xfin += w4; + yfin = _y; + _g.drawLine(xinit, yinit, xfin, yfin); + xinit = xfin; + yinit = yfin; + xfin += w4; + yfin = _y + h; + _g.drawLine(xinit, yinit, xfin, yfin); + xinit = xfin; + yinit = yfin; + xfin += w4; + yfin = _y + h / 2; + _g.drawLine(xinit, yinit, xfin, yfin); + _g.setColor(o); + g.setStroke(oldS); + } + + public void paintSelection(final Graphics2D _g2d, final EGInteractionSelection _d) { + final CtuluListSelectionInterface s = _d.getSelection(); + for (int i = s.getMaxIndex(); i >= s.getMinIndex(); i--) { + if (s.isSelected(i) && i < model_.getNbValues()) { + final int x = _d.getRepere().getXEcran(model_.getX(i)); + final int y = _d.getRepere().getYEcran(model_.getY(i), getAxeY()); + _d.getSelectionIcone().paintIconCentre(_g2d, x, y); + } + } + } + + public void removePropertyChangeListener(final PropertyChangeListener _l) {} + + public int select(final int _xEcran, final int _yEcran, final EGRepere _repere, final int _prec) { + if (model_.getNbValues() == 0) { + return -1; + } + final double x = _repere.getXReel(_xEcran); + int idx = getNearestIdx(x); + if (idx >= 0) { + final boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); + if (r) { + return idx; + } + } + idx = -idx - 2; + final int maxIdx = model_.getNbValues() - 1; + if (idx < 0) { + idx = 0; + } + if (idx > maxIdx) { + idx = maxIdx; + } + boolean r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); + if (r) { + return idx; + } + if (idx < maxIdx) { + idx++; + r = isSelected(model_.getX(idx), model_.getY(idx), _xEcran, _yEcran, _repere, getAxeY(), _prec); + if (r) { + return idx; + } + } + return -1; + } + + public boolean setAspectContour(final Color _c) { + if (_c == null) { + return false; + } + boolean r = false; + if (!_c.equals(lineModel_.getCouleur())) { + lineModel_.setCouleur(_c); + firePropertyChange(BSelecteurLineModel.PROPERTY); + r = true; + } + if (!iconeModel_.getCouleur().equals(_c)) { + iconeModel_.setCouleur(_c); + firePropertyChange(BSelecteurIconModel.DEFAULT_PROPERTY); + r = true; + } + if (r) { + fireCourbeAspectChanged(false); + firePropertyChange(BSelecteurColorChooser.DEFAULT_PROPERTY, null, _c); + } + return r; + } + + public boolean setIconeModel(final TraceIconModel _ic) { + final boolean r = iconeModel_.updateData(_ic); + if (r) { + fireCourbeAspectChanged(false); + super.firePropertyChange(BSelecteurIconModel.DEFAULT_PROPERTY, null, iconeModel_); + } + return r; + } + + public boolean setLigneMark(final TraceLigneModel _data) { + if (tLigneMarqueur_ == null) { + buildLigneMarqueur(); + } + final boolean res = tLigneMarqueur_.updateData(_data); + if (res) { + fireCourbeAspectChanged(false); + super.firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_LINE, null, iconeModel_); + } + return res; + } + + /** + * @param _marks les nouvelles marques + * @return true si modife + */ +// public boolean setMarks(final double[] _marks) { +// if (Arrays.equals(markH_, _marks)) { +// return false; +// } +// markH_ = CtuluLibArray.copy(_marks); +// fireCourbeAspectChanged(false); +// firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_VALUES, null, _marks); +// return true; +// } + /** + * @param boolean affichent _marks + * @return true si modife + */ + public boolean addMarqueur(EGCourbeMarqueur marqueur){ + getMarqueurs().add(marqueur); + modifyMarqueur(marqueur); + return true; + } + + /** + * Applique les modifs sur le graphe des la modif d'un marqueur. + * @param marqueur + */ + public void modifyMarqueur(EGCourbeMarqueur marqueur){ + fireCourbeAspectChanged(false); + firePropertyChange(EGCourbeConfigureTarget.PROP_MARK_VALUES, null, marqueur); + } + + /** + * Ajoute un marqueur g\xE9n\xE9rique initialis\xE9 a visible=false. + * @return + */ + public boolean addMarqueur(){ + EGCourbeMarqueur marqueur=new EGCourbeMarqueur(0,false,new TraceLigneModel(),true); + return addMarqueur(marqueur); + } + + public boolean deleteLastMarqueur(){ + if(getMarqueurs().size()>1){ + getMarqueurs().remove(getMarqueurs().size()-1); + return true; + } + return false; + } + + public boolean hideAllMarqueur(){ + for(EGCourbeMarqueur marqueur:getMarqueurs()){ + marqueur.setVisible(false); + } + return true; + } + public EGCourbeMarqueur getMarqueur(int indice){ + if(getMarqueurs()!=null && getMarqueurs().size()>indice) + return getMarqueurs().get(indice); + return null; + } + + + public void setMarqueurs(List<EGCourbeMarqueur> liste){ + listeMarqueurs_=liste; + } + +// /** +// * Crecupere le marqueur min +// * par convention il se trouve en premiere position +// * @return +// */ +// public EGCourbeMarqueur getMarqueurMin(){ +// if(getMarqueurs().size()>0) +// return getMarqueurs().get(0); +// return null; +// } + +// /** +// * Crecupere le marqueur max +// * par convention il se trouve en deuxieme position +// * @return +// */ +// public EGCourbeMarqueur getMarqueurMax(){ +// if(getMarqueurs().size()>1) +// return getMarqueurs().get(1); +// return null; +// } + + + public void setModel(final EGModel _model) { + model_ = _model; + } + + public boolean setTitle(final String _newTitle) { + final boolean res = model_.setTitle(_newTitle); + if (res) { + fireCourbeContentChanged(); + firePropertyChange(BSelecteurTextField.TITLE_PROPERTY, null, model_.getTitle()); + } + return res; + } + + public String toString() { + return getTitle(); + } + + public TraceBox getTbox_() { + return tbox_; + } + + public void setTbox_(TraceBox tbox_) { + this.tbox_ = tbox_; + } + + + public BConfigurePalette getPalette(){ + return paletteEnCours_; + } + + + BConfigurePalette paletteEnCours_=null; + public void setPalette(BConfigurePalette pal){ + paletteEnCours_=pal; + + } + +public static String INDICE_PANEL_SHOW="indicePtoshow"; + public boolean reloadPalette(Map infos){ + + int panelToShow=-1; + if(infos.get(INDICE_PANEL_SHOW)!=null){ + panelToShow= ((Integer)infos.get(INDICE_PANEL_SHOW)).intValue(); + } + + if(paletteEnCours_!=null) + return paletteEnCours_.setPalettePanelTarget(this,panelToShow); + + return false; + } + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2009-02-17 17:16:50 UTC (rev 4479) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2009-02-17 18:40:20 UTC (rev 4480) @@ -7,6 +7,7 @@ package org.fudaa... [truncated message content] |
From: <bma...@us...> - 2009-02-17 17:17:00
|
Revision: 4479 http://fudaa.svn.sourceforge.net/fudaa/?rev=4479&view=rev Author: bmarchan Date: 2009-02-17 17:16:50 +0000 (Tue, 17 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementInteraction.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementInteraction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementInteraction.java 2009-02-17 16:34:47 UTC (rev 4478) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementInteraction.java 2009-02-17 17:16:50 UTC (rev 4479) @@ -127,6 +127,9 @@ } public void mouseClicked(final MouseEvent _e) { + if(isGele()) { + return; + } if (_e.getClickCount() >= 2) selection_.editionAsked(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-02-17 16:34:51
|
Revision: 4478 http://fudaa.svn.sourceforge.net/fudaa/?rev=4478&view=rev Author: bmarchan Date: 2009-02-17 16:34:47 +0000 (Tue, 17 Feb 2009) Log Message: ----------- D?\195?\169placement avec accrochage. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneDeplacementAction.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDeplacement.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementTargetInterface.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepCalage.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementInteraction.java Removed Paths: ------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionAbstract.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -343,7 +343,7 @@ } } - protected boolean editionAsked() { + public boolean editionAsked() { return false; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZCalqueSelectionInteractionSimple.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -39,7 +39,7 @@ super(); } - protected boolean editionAsked() { + public boolean editionAsked() { String message = editor_.edit(); if(message!=null) FuLog.trace("EBL : ZCalqueSelectionInteractionSimple : "+message); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneDeplacementAction.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneDeplacementAction.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/action/SceneDeplacementAction.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -15,7 +15,7 @@ import org.fudaa.ebli.calque.ZScene; import org.fudaa.ebli.calque.edition.BPaletteDeplacement; import org.fudaa.ebli.calque.edition.BPaletteEdition; -import org.fudaa.ebli.calque.edition.ZCalqueDeplacement; +import org.fudaa.ebli.calque.edition.ZCalqueDeplacementInteraction; import org.fudaa.ebli.calque.edition.ZCalqueEditable; import org.fudaa.ebli.calque.edition.ZEditorInterface; import org.fudaa.ebli.calque.edition.BPaletteRotation; @@ -36,12 +36,12 @@ ZSceneEditor sceneEditor_; EbliFormatterInterface formatter_; - ZCalqueDeplacement cqDep_; + ZCalqueDeplacementInteraction cqDep_; /** * @param _m l'arbre des calques */ - public SceneDeplacementAction(final TreeSelectionModel _m, final ZSceneEditor _sceneEditor, EbliFormatterInterface _formatter, ZCalqueDeplacement _cqDep) { + public SceneDeplacementAction(final TreeSelectionModel _m, final ZSceneEditor _sceneEditor, EbliFormatterInterface _formatter, ZCalqueDeplacementInteraction _cqDep) { super(EbliResource.EBLI.getString("D\xE9placer des objets"), EbliResource.EBLI.getToolIcon("fleche-deplacement"), "GLOBAL_MOVE", _m); formatter_=_formatter; cqDep_=_cqDep; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDeplacement.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDeplacement.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/BPaletteDeplacement.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -41,11 +41,11 @@ * @version $Id: BPaletteDeplacement.java,v 1.1.2.1 2008-05-13 12:10:31 bmarchan Exp $ */ public class BPaletteDeplacement extends JPanel implements BPalettePanelInterface, ZSelectionListener, - ZCalqueDeplacement.SpecPanel, ActionListener { + ZCalqueDeplacementInteraction.SpecPanel, ActionListener { JButton btApply_; - ZCalqueDeplacement deplacement_; + ZCalqueDeplacementInteraction deplacement_; private ZSceneEditor sceneEditor_; EbliFormatterInterface formatter_; @@ -108,13 +108,13 @@ Double dz=new Double(0); if (tfDz_.isEnabled()) dz=(Double) tfDz_.getValue(); if (dx != null && dy != null && dz!=null) { - deplacement_.manualMove(dx.doubleValue(), dy.doubleValue(), dz.doubleValue()); + deplacement_.getTarget().moved(dx.doubleValue(), dy.doubleValue(), dz.doubleValue(),false); } } } - public void setCalqueDeplacement(ZCalqueDeplacement _dep) { + public void setCalqueDeplacement(ZCalqueDeplacementInteraction _dep) { deplacement_=_dep; deplacement_.specPanel_ = this; } @@ -138,11 +138,13 @@ btApply_.setEnabled(false); tfDx_.setText(formatter_.getXYFormatter().format(deplacement_.getReelDx())); tfDy_.setText(formatter_.getXYFormatter().format(deplacement_.getReelDy())); + tfDz_.setText(formatter_.getXYFormatter().format(deplacement_.getReelDz())); } else { if (!tfDx_.isEditable()) { tfDx_.setText(CtuluLibString.ZERO); tfDy_.setText(CtuluLibString.ZERO); + tfDz_.setText(CtuluLibString.ZERO); } tfDx_.setEditable(true); tfDy_.setEditable(true); Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -1,251 +0,0 @@ -/* - * @creation 4 avr. 2005 - * @modification $Date: 2008-05-13 12:10:33 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... - */ -package org.fudaa.ebli.calque.edition; - -import java.awt.Color; -import java.awt.Cursor; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; - -import javax.swing.SwingUtilities; - -import com.memoire.bu.BuResource; - -import org.fudaa.ebli.calque.BCalqueInteraction; -import org.fudaa.ebli.calque.ZCalqueSelectionInteractionAbstract; -import org.fudaa.ebli.commun.EbliLib; -import org.fudaa.ebli.commun.EbliSelectionState; -import org.fudaa.ebli.geometrie.GrPoint; -import org.fudaa.ebli.geometrie.GrVecteur; -import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.trace.TraceIcon; - -/** - * @author Fred Deniger - * @version $Id: ZCalqueDeplacement.java,v 1.13.6.2 2008-05-13 12:10:33 bmarchan Exp $ - */ -public class ZCalqueDeplacement extends BCalqueInteraction implements MouseListener, MouseMotionListener { - /** - * @author fred deniger - * @version $Id: ZCalqueDeplacement.java,v 1.13.6.2 2008-05-13 12:10:33 bmarchan Exp $ - */ - public interface SpecPanel { - void updateState(); - } - - SpecPanel specPanel_; - int dx_, dy_; - - TraceIcon ic_ = new TraceIcon(TraceIcon.CARRE, 2, Color.LIGHT_GRAY); - int initX_, initY_; - - private boolean isDragged_; - - ZCalqueDeplacementTargetInterface target_; - - GrVecteur vect_; - - public final SpecPanel getSpecPanel() { - return specPanel_; - } - - public Cursor getSpecificCursor() { - return EbliResource.EBLI.getCursor("fleche-deplacement", -1, new Point(0, 0)); - } - - public String getDescription() { - return BuResource.BU.getString("D\xE9placer"); - } - - /** - * Deplacement des objets s\xE9lectionn\xE9s. - * - * @param _dx dx reel - * @param _dy dy reel - */ - public final void manualMove(final double _dx, final double _dy, final double _dz) { -// if (isGele()) { -// return; -// } - isDragged_ = false; - if (target_ != null) { - target_.moved(_dx, _dy, _dz); - repaint(); - } - } - - public final void setSpecPanel(final SpecPanel _specPanel) { - specPanel_ = _specPanel; - } - - private void updateVect() { - if (vect_ == null) { - vect_ = new GrVecteur(); - } - vect_.x_ = dx_; - vect_.y_ = dy_; - vect_.autoApplique(getVersReel()); - } - - public double getReelDx() { - updateVect(); - return vect_.x_; - - } - - public double getReelDy() { - updateVect(); - return vect_.y_; - - } - - /** - * @return true si en cours de deplacement - */ - public final boolean isDragged() { - return isDragged_; - } - - /** - * @return true si selection vide - */ - public final boolean isSelectionEmpty() { - return target_.getSupport() == null || target_.getSupport().isSelectionEmpty(); - } - - /** - * @param _select le calque de selection - */ - public ZCalqueDeplacement(final ZCalqueSelectionInteractionAbstract _select) { - super(); - selection_ = _select; - setName("cqDeplacement"); - addMouseListener(this); - addMouseMotionListener(this); - } - - public boolean alwaysPaint() { - return true; - } - - public final ZCalqueDeplacementTargetInterface getTarget() { - return target_; - } - - public void mouseClicked(final MouseEvent _e) {} - - public void mouseDragged(final MouseEvent _e) { - if (isGele()) { - isDragged_ = false; - return; - } - if (_e.isControlDown() || _e.isAltDown()) { - return; - } - dx_ = _e.getX() - initX_; - dy_ = _e.getY() - initY_; - if (!isDragged_ && (dx_ * dx_ + dy_ * dy_) > 10) { - isDragged_ = true; - } - updateSpecPanel(); - repaint(); - } - - private void updateSpecPanel() { - if (specPanel_ != null) { - specPanel_.updateState(); - } - } - - public void mouseEntered(final MouseEvent _e) { - if (isGele()) { - isDragged_ = false; - return; - } - isDragged_ = false; - repaint(); - } - - public void mouseExited(final MouseEvent _e) { - if (isGele()) { - isDragged_ = false; - return; - } - isDragged_ = false; - repaint(); - } - - public void mouseMoved(final MouseEvent _e) {} - - public void mousePressed(final MouseEvent _e) { - if (!SwingUtilities.isLeftMouseButton(_e) || EbliLib.isPopupMouseEvent(_e)) { - return; - } - if (isGele()) { - isDragged_ = false; - return; - } - initX_ = _e.getX(); - initY_ = _e.getY(); - if (state_ == null) { - state_ = new EbliSelectionState(); - } - state_.majControleDesc(_e); - final GrPoint pt = new GrPoint(initX_, initY_, 0); - pt.autoApplique(getVersReel()); - target_.getSupport().changeSelection(pt, 5, state_.getModificateur()); - updateSpecPanel(); - repaint(); - } - - EbliSelectionState state_; - - public void mouseReleased(final MouseEvent _e) { - if (!SwingUtilities.isLeftMouseButton(_e) || EbliLib.isPopupMouseEvent(_e)) { - return; - } - if (isGele()) { - isDragged_ = false; - return; - } else if (isDragged_ && target_ != null && !_e.isControlDown() && !_e.isAltDown()) { - dx_ = _e.getX() - initX_; - dy_ = _e.getY() - initY_; - target_.moved(getReelDx(), getReelDy(),0); - isDragged_ = false; - } - updateSpecPanel(); - repaint(); - } - - ZCalqueSelectionInteractionAbstract selection_; - - public void paintComponent(final Graphics _g) { - if (isGele() || target_ == null || target_.getSupport() == null) { - return; - } - if (selection_ != null && !target_.getSupport().isSelectionEmpty()) { - target_.getSupport() - .paintSelection((Graphics2D) _g, selection_.getTrace(), getVersEcran(), getClipReel(_g)); - } - if (target_ != null && isDragged_) { - target_.paintMove((Graphics2D) _g, dx_, dy_, ic_); - } - - } - - public final void setTarget(final ZCalqueDeplacementTargetInterface _target) { - if (target_ != _target) { - target_ = _target; - isDragged_ = false; - } - } -} Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementInteraction.java (from rev 4477, branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacement.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementInteraction.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementInteraction.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -0,0 +1,269 @@ +/* + * @creation 4 avr. 2005 + * @modification $Date: 2008-05-13 12:10:33 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ebli.calque.edition; + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; + +import javax.swing.SwingUtilities; + +import com.memoire.bu.BuResource; + +import org.fudaa.ebli.calque.BCalqueInteraction; +import org.fudaa.ebli.calque.ZCalqueSelectionInteractionAbstract; +import org.fudaa.ebli.calque.ZCatchEvent; +import org.fudaa.ebli.calque.ZCatchListener; +import org.fudaa.ebli.commun.EbliLib; +import org.fudaa.ebli.commun.EbliSelectionState; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.ebli.geometrie.GrVecteur; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.trace.TraceIcon; + +/** + * Un calque d'interaction d\xE9placement. + * @author Fred Deniger, Bertrand Marchand + * @version $Id: ZCalqueDeplacement.java,v 1.13.6.2 2008-05-13 12:10:33 bmarchan Exp $ + */ +public class ZCalqueDeplacementInteraction extends BCalqueInteraction implements MouseListener, MouseMotionListener, ZCatchListener { + /** + * @author fred deniger + * @version $Id: ZCalqueDeplacement.java,v 1.13.6.2 2008-05-13 12:10:33 bmarchan Exp $ + */ + public interface SpecPanel { + void updateState(); + } + SpecPanel specPanel_; + TraceIcon ic_ = new TraceIcon(TraceIcon.CARRE, 2, Color.LIGHT_GRAY); + private boolean isDragged_; + ZCalqueDeplacementTargetInterface target_; + + /** Le point d'accrochage, pass\xE9 par le calque d'accrochage */ + GrPoint ptAccroch_=null; + /** Le point d'origine */ + GrPoint ptOrig_=null; + /** Vrai si le point d'origine est accroch\xE9 */ + boolean baccrOrig_=false; + /** Vrai si le point courant est accroch\xE9 */ + boolean baccrCurrent_=false; + /** Le vecteur de deplacement, en coordonn\xE9es reelles. */ + GrVecteur vect_; + + + public final SpecPanel getSpecPanel() { + return specPanel_; + } + + public Cursor getSpecificCursor() { + return EbliResource.EBLI.getCursor("fleche-deplacement", -1, new Point(0, 0)); + } + + public String getDescription() { + return BuResource.BU.getString("D\xE9placer"); + } + + public final void setSpecPanel(final SpecPanel _specPanel) { + specPanel_ = _specPanel; + } + + public double getReelDx() { + return vect_.x_; + + } + + public double getReelDy() { + return vect_.y_; + } + + public double getReelDz() { + if (baccrCurrent_&&baccrOrig_) + return vect_.z_; + else + return 0; + } + + /** + * @return true si en cours de deplacement + */ + public final boolean isDragged() { + return isDragged_; + } + + /** + * @return true si selection vide + */ + public final boolean isSelectionEmpty() { + return target_.getSupport() == null || target_.getSupport().isSelectionEmpty(); + } + + /** + * @param _select le calque de selection + */ + public ZCalqueDeplacementInteraction(final ZCalqueSelectionInteractionAbstract _select) { + super(); + selection_ = _select; + setName("cqDeplacement"); + addMouseListener(this); + addMouseMotionListener(this); + } + + public boolean alwaysPaint() { + return true; + } + + public final ZCalqueDeplacementTargetInterface getTarget() { + return target_; + } + + public void mouseClicked(final MouseEvent _e) { + if (_e.getClickCount() >= 2) + selection_.editionAsked(); + } + + public void mouseDragged(final MouseEvent _e) { + if (isGele()) { + isDragged_ = false; + return; + } + if (_e.isControlDown() || _e.isAltDown()) { + return; + } + + baccrCurrent_=ptAccroch_!=null; + vect_=getCurrentPoint(_e).soustraction(ptOrig_); + + if (!isDragged_ && vect_.applique(getVersEcran()).norme() > 10) { + isDragged_ = true; + } + updateSpecPanel(); + repaint(); + } + + private void updateSpecPanel() { + if (specPanel_ != null) { + specPanel_.updateState(); + } + } + + public void mouseEntered(final MouseEvent _e) { + if (isGele()) { + isDragged_ = false; + return; + } + isDragged_ = false; + repaint(); + } + + public void mouseExited(final MouseEvent _e) { + if (isGele()) { + isDragged_ = false; + return; + } + isDragged_ = false; + repaint(); + } + + public void mouseMoved(final MouseEvent _e) {} + + public void mousePressed(final MouseEvent _e) { + if (!SwingUtilities.isLeftMouseButton(_e) || EbliLib.isPopupMouseEvent(_e)) { + return; + } + if (isGele()) { + isDragged_ = false; + return; + } + if (state_ == null) { + state_ = new EbliSelectionState(); + } + state_.majControleDesc(_e); + + baccrOrig_=ptAccroch_!=null; + ptOrig_=getCurrentPoint(_e); + + target_.getSupport().changeSelection(ptOrig_, 5, state_.getModificateur()); + updateSpecPanel(); + repaint(); + } + + EbliSelectionState state_; + + public void mouseReleased(final MouseEvent _e) { + if (!SwingUtilities.isLeftMouseButton(_e) || EbliLib.isPopupMouseEvent(_e)) { + return; + } + if (isGele()) { + isDragged_ = false; + return; + } + else if (isDragged_ && target_ != null && !_e.isControlDown() && !_e.isAltDown()) { + + baccrCurrent_=ptAccroch_!=null; + vect_=getCurrentPoint(_e).soustraction(ptOrig_); + + target_.moved(vect_.x_, vect_.y_, baccrOrig_&&baccrCurrent_?vect_.z_:0,true); + isDragged_ = false; + } + updateSpecPanel(); + repaint(); + } + + /** + * Retourne le point courant, qui peut \xEAtre un point d'accrochage. + * @param _e L'evenement souris + * @return Le point courant. + */ + private GrPoint getCurrentPoint(MouseEvent _e) { + GrPoint pt; + if (ptAccroch_!=null) { + pt=ptAccroch_; + } + else { + pt=new GrPoint(_e.getX(),_e.getY(),0); + pt.autoApplique(getVersReel()); + } + return pt; + } + + ZCalqueSelectionInteractionAbstract selection_; + + public void paintComponent(final Graphics _g) { + if (isGele() || target_ == null || target_.getSupport() == null) { + return; + } + if (selection_ != null && !target_.getSupport().isSelectionEmpty()) { + target_.getSupport() + .paintSelection((Graphics2D) _g, selection_.getTrace(), getVersEcran(), getClipReel(_g)); + } + if (target_ != null && isDragged_) { + GrVecteur vct=vect_.applique(getVersEcran()); + target_.paintMove((Graphics2D) _g, (int)vct.x_,(int)vct.y_, ic_); + } + + } + + public final void setTarget(final ZCalqueDeplacementTargetInterface _target) { + if (target_ != _target) { + target_ = _target; + isDragged_ = false; + } + } + + public void catchChanged(ZCatchEvent _evt) { + if (_evt.type==ZCatchEvent.CAUGHT) + ptAccroch_=_evt.selection.getScene().getVertex(_evt.idxGeom,_evt.idxVertex); + else + ptAccroch_=null; + } +} Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementPanel.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementPanel.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -35,11 +35,11 @@ * @version $Id: ZCalqueDeplacementPanel.java,v 1.6.8.2 2008-02-21 15:18:29 bmarchan Exp $ */ public class ZCalqueDeplacementPanel extends JPanel implements ZEditorPanelInterface, - ZCalqueDeplacement.SpecPanel, ActionListener { + ZCalqueDeplacementInteraction.SpecPanel, ActionListener { JButton btApply_; - final ZCalqueDeplacement deplacement_; + final ZCalqueDeplacementInteraction deplacement_; EbliFormatterInterface formatter_; @@ -53,7 +53,7 @@ * @param _deplacement le calque de deplacement * @param _formatter */ - public ZCalqueDeplacementPanel(final ZCalqueDeplacement _deplacement, + public ZCalqueDeplacementPanel(final ZCalqueDeplacementInteraction _deplacement, final EbliFormatterInterface _formatter) { super(); @@ -100,7 +100,7 @@ Double dz=new Double(0); if (tfDz_.isEnabled()) dz=(Double) tfDz_.getValue(); if (dx != null && dy != null && dz!=null) { - deplacement_.manualMove(dx.doubleValue(), dy.doubleValue(), dz.doubleValue()); + deplacement_.getTarget().moved(dx.doubleValue(), dy.doubleValue(), dz.doubleValue(),false); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementTargetInterface.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementTargetInterface.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZCalqueDeplacementTargetInterface.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -30,11 +30,13 @@ /** + * Translate les objets. * @param _dx le dx reel * @param _dy le dy reel * @param _dz le dz reel. S'applique au Z attribut du calque support. + * @param _confirmOnZ true : Pour demander \xE0 l'utilisateur de confirmer le d\xE9placement suivant Z. */ - void moved(double _dx,double _dy, double _dz); + void moved(double _dx,double _dy, double _dz, boolean _confirmOnZ); /** * @return le calque contenant la selection Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/edition/ZEditorDefault.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -113,7 +113,7 @@ protected ZSceneEditor sceneEditor_=null; - ZCalqueDeplacement move_; + ZCalqueDeplacementInteraction move_; ZCalqueClickInteraction nodeAdd_; @@ -247,9 +247,9 @@ return "GLOBAL_MOVE".equals(state_); } - private ZCalqueDeplacement buildDeplacement() { + private ZCalqueDeplacementInteraction buildDeplacement() { if (move_ == null) { - move_ = new ZCalqueDeplacement(panel_.getCqSelectionI()); + move_ = new ZCalqueDeplacementInteraction(panel_.getCqSelectionI()); move_.addPropertyChangeListener("gele", this); panel_.addCalqueInteraction(move_); move_.setTarget(this); @@ -616,18 +616,14 @@ } } - public void moved(final double _dx, final double _dy, final double _dz) { + public void moved(double _dx, double _dy, double _dz, boolean _confirmOnZ) { + if (_confirmOnZ && _dz!=0 && + !ui_.question(EbliLib.getS("Accroche suivant Z"), + EbliLib.getS("Voulez vous translater les objets\ns\xE9lectionn\xE9s suivant DZ={0} ?", + getXYFormatter().getXYFormatter().format(_dz)))) + _dz=0; + sceneEditor_.moveSelectedObjects(_dx, _dy, _dz); -// ZCalqueEditable[] cqs=getSupport().getEditableLayers(); -// final CtuluCommandComposite cmp = new CtuluCommandComposite(); -// for (int i=0; i<cqs.length; i++) { -// if (/*target_ != null && */(_dx != 0 || _dy != 0 || _dz!=0)) { -// cqs[i].moveSelectedObjects(_dx, _dy, _dz, cmp, ui_); -// } -// } -// if (mng_ != null) { -// mng_.addCmd(cmp.getSimplify()); -// } } public void paintMove(final Graphics2D _g, final int _dx, final int _dy, final TraceIcon _ic) { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/layer/FSigVisuPanel.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -29,7 +29,7 @@ import org.fudaa.ebli.calque.action.SceneSelectNextAction; import org.fudaa.ebli.calque.action.SceneSelectPreviousAction; import org.fudaa.ebli.calque.action.SceneShowDistanceAction; -import org.fudaa.ebli.calque.edition.ZCalqueDeplacement; +import org.fudaa.ebli.calque.edition.ZCalqueDeplacementInteraction; import org.fudaa.ebli.calque.edition.ZCalqueEditionGroup; import org.fudaa.ebli.calque.edition.ZEditorDefault; import org.fudaa.ebli.commun.EbliActionInterface; @@ -92,10 +92,10 @@ return cq; } - protected ZCalqueDeplacement getCalqueDeplacement() { - ZCalqueDeplacement cqDep=null; - if ((cqDep=(ZCalqueDeplacement)getVueCalque().getCalque().getCalqueParNom("cqDeplacement"))==null) { - cqDep=new ZCalqueDeplacement(getCqSelectionI()); + protected ZCalqueDeplacementInteraction getCalqueDeplacement() { + ZCalqueDeplacementInteraction cqDep=null; + if ((cqDep=(ZCalqueDeplacementInteraction)getVueCalque().getCalque().getCalqueParNom("cqDeplacement"))==null) { + cqDep=new ZCalqueDeplacementInteraction(getCqSelectionI()); this.addCalqueInteraction(cqDep); cqDep.setGele(true); cqDep.setTarget(getEditor()); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepCalage.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepCalage.java 2009-02-16 21:23:26 UTC (rev 4477) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/sig/wizard/FSigImageWizardStepCalage.java 2009-02-17 16:34:47 UTC (rev 4478) @@ -38,7 +38,7 @@ import org.fudaa.ebli.calque.ZModeleStatiqueImageRaster; import org.fudaa.ebli.calque.ZScene; import org.fudaa.ebli.calque.action.CalqueActionInteraction; -import org.fudaa.ebli.calque.edition.ZCalqueDeplacement; +import org.fudaa.ebli.calque.edition.ZCalqueDeplacementInteraction; import org.fudaa.ebli.calque.edition.ZCalqueDeplacementTargetInterface; import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliComponentFactory; @@ -145,7 +145,7 @@ tb.add(tbTool); center.add(tb, BuBorderLayout.NORTH); add(center, BuBorderLayout.CENTER); - final ZCalqueDeplacement move = new ZCalqueDeplacement(pn_.getCqSelectionI()); + final ZCalqueDeplacementInteraction move = new ZCalqueDeplacementInteraction(pn_.getCqSelectionI()); move.setGele(true); pn_.addCalqueInteraction(move); move.setTarget(new ZCalqueDeplacementTargetInterface() { @@ -155,7 +155,7 @@ } - public void moved(final double _dx, final double _dy, double _dz) { + public void moved(final double _dx, final double _dy, double _dz, boolean _confirmOnZ) { controller.getCalageCalque().moveSelectedObjects(_dx, _dy, _dz, control_.getMng(), control_.getUi()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-02-16 21:23:32
|
Revision: 4477 http://fudaa.svn.sourceforge.net/fudaa/?rev=4477&view=rev Author: bmarchan Date: 2009-02-16 21:23:26 +0000 (Mon, 16 Feb 2009) Log Message: ----------- Modeleur 1D : Correction pour prise en compte d?\195?\169calage Axe hydro. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainer.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/ExportPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/OpenBiefPanel.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestion.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionAxeHydraulique.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionProfil.java Removed Paths: ------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueContainerModules.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueExport.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueImportation.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionAxeHydraulique.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionProfil.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -32,7 +32,7 @@ import org.fudaa.fudaa.modeleur.modeleur1d.model.Bief; import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsBief1d; import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsProfil1d; -import org.fudaa.fudaa.modeleur.modeleur1d.view.VueImportation; +import org.fudaa.fudaa.modeleur.modeleur1d.view.OpenBiefPanel; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; @@ -208,11 +208,19 @@ private void normalizePKData() throws CancelException { GISZoneCollection zone=profils_.getGeomData(); int idxAttCommentaireHydraulique=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); - // Vrai si les PK existes. + // Vrai si les PK existent sur tous les profils. boolean attrIsCorrectlyValued=false; // Vrai si les PK existe et correspond \xE0 l'axe hydraulique si il existe. boolean attrMatchWithAxeHydraulique=false; boolean presenceAxeHydraulique=axeHydraulique_.getNombre()>0; + // D\xE9calage du d\xE9but d'abscisse de l'axe + double decalAxe=0.0; + int idxAttDecalAxe=axeHydraulique_.getGeomData().getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE); + if (idxAttDecalAxe!=-1) { + decalAxe=((Double)axeHydraulique_.getGeomData().getValue(idxAttDecalAxe, 0)).doubleValue(); + } + + // L'attribut COMMENTAIRE_HYDRO est pr\xE9sent, test que les valeurs sont concordantes avec l'axe. if (idxAttCommentaireHydraulique!=-1) { attrIsCorrectlyValued=true; if(presenceAxeHydraulique) @@ -222,6 +230,7 @@ // V\xE9rification de la pr\xE9sence des donn\xE9es PK \\ String CommHydrauValue=(String)profils_.getGeomData().getValue(idxAttCommentaireHydraulique, i); attrIsCorrectlyValued=GISLib.isHydroCommentValued(CommHydrauValue, "PK"); + // V\xE9rification de la coh\xE9rence avec l'axe hydraulique \\ if (presenceAxeHydraulique) { double hydraoCommValue=GISLib.getHydroCommentDouble(CommHydrauValue, "PK"); @@ -231,40 +240,45 @@ throw new IllegalArgumentException(FudaaLib .getS("Au moins un des profils coupe plusieurs fois ou jamais l'axe hydraulique.")); attrMatchWithAxeHydraulique=attrIsCorrectlyValued&&attrMatchWithAxeHydraulique - &&Math.abs(hydraoCommValue-absCurvValue)<0.0001; + &&Math.abs(hydraoCommValue-(absCurvValue+decalAxe))<0.0001; } } } - if (idxAttCommentaireHydraulique==-1) - // Ajout de l'attribut COMMENTAIRE_HYDRO - if (idxAttCommentaireHydraulique==-1) { - GISAttributeInterface[] atts=new GISAttributeInterface[zone.getNbAttributes()+1]; - for (int k=0; k<zone.getNbAttributes(); k++) - atts[k]=zone.getAttribute(k); - atts[atts.length-1]=GISAttributeConstants.COMMENTAIRE_HYDRO; - zone.setAttributes(atts, null); - } + + // Ajout de l'attribut COMMENTAIRE_HYDRO + else { + GISAttributeInterface[] atts=new GISAttributeInterface[zone.getNbAttributes()+1]; + for (int k=0; k<zone.getNbAttributes(); k++) + atts[k]=zone.getAttribute(k); + atts[atts.length-1]=GISAttributeConstants.COMMENTAIRE_HYDRO; + zone.setAttributes(atts, null); + } + + // Les PK n'ont pas \xE9t\xE9 correctement \xE9valu\xE9s, valuation a partir de l'axe hydrau s'il existe, 0 + // sinon. if (!attrIsCorrectlyValued) { - // Valuation de l'attribut, a partir de l'axe hydrau si il existe, 0 - // sinon. idxAttCommentaireHydraulique=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); for (int k=0; k<zone.getNumGeometries(); k++) { String comm=(String)profils_.getGeomData().getValue(idxAttCommentaireHydraulique, k); - if (!GISLib.isHydroCommentValued(comm, "PK")) + if (!GISLib.isHydroCommentValued(comm, "PK")) { + double pk; if (presenceAxeHydraulique) { // Valuation avec le croisement avec l'axe hydraulique - double abscurv=UtilsProfil1d.abscisseCurviligne(axeHydraulique_.getGeomData().getCoordinateSequence(0), profils_ - .getGeomData().getCoordinateSequence(k)); - zone.setAttributValue(idxAttCommentaireHydraulique, k, GISLib.setHydroCommentDouble(comm, abscurv, "PK"), null); + pk=UtilsProfil1d.abscisseCurviligne(axeHydraulique_.getGeomData().getCoordinateSequence(0), profils_ + .getGeomData().getCoordinateSequence(k))+decalAxe; } - else - // Valuation avec 0 - zone.setAttributValue(idxAttCommentaireHydraulique, k, GISLib.setHydroCommentDouble(comm, 0, "PK"), null); + else { + // Valuation avec le d\xE9calage de l'axe. + pk=decalAxe; + } + zone.setAttributValue(idxAttCommentaireHydraulique, k, GISLib.setHydroCommentDouble(comm, pk, "PK"), null); + } } attrMatchWithAxeHydraulique=true; } + if (!attrMatchWithAxeHydraulique&&presenceAxeHydraulique) { - VueImportation vImport=new VueImportation(); + OpenBiefPanel vImport=new OpenBiefPanel(); if (!vImport.run()) throw new CancelException(FudaaLib.getS("L'importation a \xE9t\xE9 annul\xE9.")); if (vImport.axeHydrauChosen()) { @@ -273,9 +287,9 @@ for (int k=0; k<zone.getNumGeometries(); k++) { String comm=(String)profils_.getGeomData().getValue(idxAttCommentaireHydraulique, k); // Valuation avec le croisement avec l'axe hydraulique - double abscurv=UtilsProfil1d.abscisseCurviligne(axeHydraulique_.getGeomData().getCoordinateSequence(0), profils_ - .getGeomData().getCoordinateSequence(k)); - zone.setAttributValue(idxAttCommentaireHydraulique, k, GISLib.setHydroCommentDouble(comm, abscurv, "PK"), null); + double pk=UtilsProfil1d.abscisseCurviligne(axeHydraulique_.getGeomData().getCoordinateSequence(0), profils_ + .getGeomData().getCoordinateSequence(k))+decalAxe; + zone.setAttributValue(idxAttCommentaireHydraulique, k, GISLib.setHydroCommentDouble(comm, pk, "PK"), null); } } else { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -50,10 +50,10 @@ import org.fudaa.fudaa.modeleur.modeleur1d.model.Bief; import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsProfil1d; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueBief; -import org.fudaa.fudaa.modeleur.modeleur1d.view.VueContainerModules; +import org.fudaa.fudaa.modeleur.modeleur1d.view.PnGestion; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueCourbe; -import org.fudaa.fudaa.modeleur.modeleur1d.view.VueExport; -import org.fudaa.fudaa.modeleur.modeleur1d.view.VueModuleGestionAxeHydraulique; +import org.fudaa.fudaa.modeleur.modeleur1d.view.ExportPanel; +import org.fudaa.fudaa.modeleur.modeleur1d.view.PnGestionAxeHydraulique; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueTableau; import com.memoire.bu.BuDesktop; @@ -82,7 +82,7 @@ /** Un label pour afficher les erreurs. */ private BuLabel vueError_=new BuLabel(); /** La vue des modules contenu dans la colonne \xE0 droite. */ - private VueContainerModules vueContainerModules_; + private PnGestion vueContainerModules_; /** La frame contenant tous les widgets 1d. */ private MdlFille1d frame1d_; @@ -122,9 +122,9 @@ controllerProfil_=new ControllerProfil(controllerBief_.getBiefSelectionModel(), controllerBief_.getBiefContainer(), this); // Instanciation des Vues \\ // Modules - vueContainerModules_=new VueContainerModules(modelContainerModules_); + vueContainerModules_=new PnGestion(modelContainerModules_); addVueModule(controllerBief_.getVueModuleGestionBief()); - addVueModule(new VueModuleGestionAxeHydraulique(controllerBief_)); + addVueModule(new PnGestionAxeHydraulique(controllerBief_)); addVueModule(controllerProfil_.getVueModuleGestionProfil()); // Vue Bief controllerBief_.getVueBief().getScene().addSelectionListener(this); @@ -193,7 +193,7 @@ public JComponent getVueError(){ return vueError_; } - public VueContainerModules getVueContainerModules(){ + public PnGestion getVueContainerModules(){ return vueContainerModules_; } @@ -362,7 +362,7 @@ // Gestion de l'export \\ public void export(){ - VueExport vueExport=new VueExport(appli_); + ExportPanel vueExport=new ExportPanel(appli_); if(!vueExport.run()) return; // Configuration du mascaretWriter Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -23,6 +23,7 @@ import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.ebli.calque.BCalque; import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; import org.fudaa.fudaa.commun.FudaaLib; @@ -34,7 +35,7 @@ import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsProfil1d; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueBief; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueFusionBief; -import org.fudaa.fudaa.modeleur.modeleur1d.view.VueModuleGestionBief; +import org.fudaa.fudaa.modeleur.modeleur1d.view.PnGestionBief; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; @@ -57,7 +58,7 @@ /** Le model de selection des biefs. */ protected BiefSelectionModel biefSelectionModel_; /** La vue du module de gestion des biefs. */ - protected VueModuleGestionBief vueModuleGestionBief_; + protected PnGestionBief vueModuleGestionBief_; /** La vue sur les biefs. */ protected VueBief vueBief_; @@ -65,7 +66,7 @@ controller1d_=_controller1d; biefContainerAdapter_=new BiefContainerAdapter(biefSet_); biefSelectionModel_=new BiefSelectionModel(); - vueModuleGestionBief_=new VueModuleGestionBief(this); + vueModuleGestionBief_=new PnGestionBief(this); vueBief_=new VueBief(controller1d_.getImplementation(), this); } @@ -91,6 +92,36 @@ } /** + * Decale les abscisses des profils du bief en fonction de l'abscisse donn\xE9 pour le d\xE9but de l'axe hydraulique + */ + public void setDebutAbscisseAxe(double _abs) { + if (!getBiefContainer().hasAxeHydraulique()) return; + double decal=_abs-getBiefContainer().getDecalageAxeHydraulique(); + if (decal==0) return; + + CtuluCommandComposite cmp=new CtuluCommandComposite("Modifier abscisse curviligne de l'axe"); + + // Changement de l'attribut PK sur axe. + GISZoneCollection zaxe=getBiefContainer().getZoneAxeHydraulique(); + if (zaxe.getNumGeometries()>0) { + int idxAttr=zaxe.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE); + zaxe.setAttributValue(idxAttr, 0, _abs, cmp); + } + + // D\xE9calage des profils + GISZoneCollectionLigneBrisee zone=getBiefContainer().getZoneProfils(); + for (int i=0; i<zone.getNbGeometries(); i++) { + String value=(String)zone.getValue(zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), i); + double oldval=GISLib.getHydroCommentDouble(value, "PK"); + String s=GISLib.setHydroCommentDouble(value, oldval+decal, "PK"); + zone.setAttributValue(zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), i, s, cmp); + } + + if (getCommandManager()!=null) + getCommandManager().addCmd(cmp.getSimplify()); + } + + /** * R\xE9ordonne les profils du bief selectionn\xE9. retourne le nouvel indice de * l'indice pass\xE9 en param\xE8tre (-1 si inutilis\xE9). */ @@ -135,7 +166,7 @@ /** * Retourne la vue du module de gestion des biefs. */ - public VueModuleGestionBief getVueModuleGestionBief(){ + public PnGestionBief getVueModuleGestionBief(){ return vueModuleGestionBief_; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerProfil.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -17,7 +17,7 @@ import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainer; import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainerAdapter; import org.fudaa.fudaa.modeleur.modeleur1d.model.ProfilContainerException; -import org.fudaa.fudaa.modeleur.modeleur1d.view.VueModuleGestionProfil; +import org.fudaa.fudaa.modeleur.modeleur1d.view.PnGestionProfil; /** * Controller permettant de g\xE9rer (cr\xE9er, modifier, supprimer, selectionner) les profils. @@ -35,14 +35,14 @@ /** le conteneur du bief. */ private BiefContainer biefContainer_; /** La vue du module de gestion des profils. */ - protected VueModuleGestionProfil vueModuleGestionProfil_; + protected PnGestionProfil vueModuleGestionProfil_; public ControllerProfil(BiefSelectionModel _biefSelectionModel, BiefContainer _biefContainer, Controller1d _controller1d){ controller1d_=_controller1d; biefContainer_=_biefContainer; profilSelectionModel_=new ProfilSelectionModel(_biefSelectionModel); profilContainerAdapter_=new ProfilContainerAdapter(biefContainer_); - vueModuleGestionProfil_=new VueModuleGestionProfil(this); + vueModuleGestionProfil_=new PnGestionProfil(this); } public ProfilContainer getProfilContainer(){ @@ -67,7 +67,7 @@ /** * Retourne la vue du module de gestion des profils. */ - public VueModuleGestionProfil getVueModuleGestionProfil(){ + public PnGestionProfil getVueModuleGestionProfil(){ return vueModuleGestionProfil_; } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainer.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainer.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainer.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -22,6 +22,12 @@ /** Retourne vrai si l'index pass\xE9 en param\xE8tre correspond \xE0 un profil. */ public boolean hasProfil(int _idxProfil); + /** Retourne vrai si un axe hydraulique existe */ + public boolean hasAxeHydraulique(); + + /** Retourne la valeur de d\xE9calage de l'axe hydraulique. */ + public double getDecalageAxeHydraulique(); + /** Ajout d'un nouveau listener. */ public void addBiefContainerListener(BiefContainerListener _listener); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerAdapter.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefContainerAdapter.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -15,6 +15,7 @@ import org.fudaa.ctulu.CtuluCommandContainer; import org.fudaa.ctulu.CtuluNamedCommand; import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; import org.fudaa.fudaa.commun.FudaaLib; @@ -46,6 +47,17 @@ return false; } + public boolean hasAxeHydraulique() { + GISZoneCollectionLigneBrisee zone=getZoneAxeHydraulique(); + return zone!=null && zone.getNbGeometries()>0; + } + + public double getDecalageAxeHydraulique() { + GISZoneCollection zone=getZoneAxeHydraulique(); + int idxAttr=zone.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE); + return ((Double)zone.getValue(idxAttr, 0)).doubleValue(); + } + /** * Selectionner un des biefs. Pour n'en selectionner aucun, _nomBief doit * valloir null. Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainer.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -80,18 +80,20 @@ /** Supprime le point indiqu\xE9 en param\xE8tre. */ public void remove(int _idxPoint, CtuluCommandContainer _cmd) throws ProfilContainerException; - /** Retourne l'abscisse curviligne du profil sur l'axe hydraulique. -1 si inexistant. */ + /** + * Retourne le PK du profil sur l'axe. Correspond a l'abscisse curviligne + d\xE9calage de d\xE9but de l'axe. + */ public double getAbsCurvProfilOnAxeHydraulique(); /** - * Met l'abscisse curviligne du profil sur l'axe hydraulique \xE0 _value. + * D\xE9place le profil sur l'axe, en fonction d'un abscisse curviligne donn\xE9. * Retourne vrai il est n\xE9c\xE9ssaire d'effectuer une r\xE9ordonnancement des * profils sur l'axe hydraulique. - * _value ne peut \xEAtre ni n\xE9gatif ni sup\xE9rieur \xE0 l'abscisse curviligne total + * @param _pk Le PK du profil. Ne peut \xEAtre ni n\xE9gatif ni sup\xE9rieur \xE0 l'abscisse curviligne total * de l'axe, dans ces cas une exception de type * {@link IllegalArgumentException} est lev\xE9e. */ - public boolean setAbsCurvProfilOnAxeHydraulique(double _value, CtuluCommandContainer _cmd) throws ProfilContainerException; + public boolean moveProfilOnAxeHydraulique(double _pk, CtuluCommandContainer _cmd) throws ProfilContainerException; /** Place l'intersection du profil avec la limite de stockage gauche \xE0 l'index _idx. */ public void setLimiteGauche(int _idx, CtuluCommandContainer _cmd); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -380,6 +380,19 @@ return GISLib.getHydroCommentDouble(value, "PK"); } + /** + * Definit le PK du profil sur l'axe. + */ + public void setAbsCurvProfilOnAxeHydraulique(double _abs, CtuluCommandContainer _cmd) { + if (idxProfilSelected_==-1) + return; + GISZoneCollection zone=biefContainer_.getZoneProfils(); + String value=(String)zone.getValue(zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), idxProfilSelected_); + String s=GISLib.setHydroCommentDouble(value, _abs, "PK"); + zone.setAttributValue(zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), idxProfilSelected_, s, _cmd); + fireProfilContainerDataModified(); + } + public int getNbLignesDirectrices() { if (idxProfilSelected_==-1) return 0; @@ -568,15 +581,15 @@ fireProfilContainerDataModified(); } - public boolean setAbsCurvProfilOnAxeHydraulique(double _value, CtuluCommandContainer _cmd) throws ProfilContainerException { - _value=_value-curviligneDecalage_; - CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un profil")); + public boolean moveProfilOnAxeHydraulique(double _pk, CtuluCommandContainer _cmd) throws ProfilContainerException { + double absZeroDecal=_pk-curviligneDecalage_; + CtuluCommandComposite cmp=new CtuluCommandComposite(); // Cas si un axe hydraulique existe \\ if (biefContainer_.getZoneAxeHydraulique().getNumGeometries()>0) { CoordinateSequence axeHydrau=((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneAxeHydraulique().getGeometry(0)) .getCoordinateSequence(); Geometry geomAxeHydrau=biefContainer_.getZoneAxeHydraulique().getGeometry(0); - if (_value<0||_value>UtilsProfil1d.abscisseCurviligne(axeHydrau, axeHydrau.getCoordinate(axeHydrau.size()-1))) + if (absZeroDecal<0||absZeroDecal>UtilsProfil1d.abscisseCurviligne(axeHydrau, axeHydrau.getCoordinate(axeHydrau.size()-1))) throw new IllegalArgumentException(FudaaLib.getS("L'abscisse curviligne doit \xEAtre entre "+curviligneDecalage_+" et " +(UtilsProfil1d.abscisseCurviligne(axeHydrau, axeHydrau.getCoordinate(axeHydrau.size()-1))+curviligneDecalage_) +" inclus.")); @@ -588,19 +601,19 @@ // Point de croisement actuel entre l'axe et le profil Coordinate oldCoordCroisement=intersection.getCoordinate(); double oldAbscisseCurviligne=UtilsProfil1d.abscisseCurviligne(axeHydrau, oldCoordCroisement); - if (!UtilsProfil1d.egal(_value, oldAbscisseCurviligne)) { + if (!UtilsProfil1d.egal(absZeroDecal, oldAbscisseCurviligne)) { // Cr\xE9ation d'une selection contenant la g\xE9om\xE9trie \xE0 modifier BitSet bs=new BitSet(biefContainer_.getZoneProfils().getNbGeometries()); bs.set(idxProfilSelected_); CtuluListSelection selection=new CtuluListSelection(bs); // Calcul du future point de croisement entre l'axe et le profil - Coordinate newCoordCroisement=UtilsProfil1d.getCoordinateXY(axeHydrau, _value); + Coordinate newCoordCroisement=UtilsProfil1d.getCoordinateXY(axeHydrau, absZeroDecal); // Application de la translation Coordinate move=UtilsProfil1d.vec(oldCoordCroisement, newCoordCroisement); // R\xE9duction de la pr\xE9cision pour \xE9viter les probl\xE8mes d'arrondis move.x=((double) ((long) (move.x*10000.)))/10000; move.y=((double) ((long) (move.y*10000.)))/10000; - biefContainer_.getModelProfils().moveGlobal(selection, move.x, move.y, 0, cmd); + biefContainer_.getModelProfils().moveGlobal(selection, move.x, move.y, 0, cmp); // Somme de tous les angles de l'axe entre les deux points de // translation int oldNextIdx=UtilsProfil1d.getNextIndex(axeHydrau, oldCoordCroisement); @@ -619,37 +632,36 @@ -UtilsProfil1d.getAngle(axeHydrau.getCoordinate(i), axeHydrau.getCoordinate(i+1), axeHydrau.getCoordinate(i+2)); // Application de la rotation biefContainer_.getModelProfils() - .rotateGlobal(selection, newAngle-oldAngle, newCoordCroisement.x, newCoordCroisement.y, cmd); + .rotateGlobal(selection, newAngle-oldAngle, newCoordCroisement.x, newCoordCroisement.y, cmp); // Verifie que le profil ne coupe pas deux fois l'axe hydraulique Geometry intersect=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)); if (intersect.getNumPoints()!=1) { - cmd.undo(); // Annulation des modifications + cmp.undo(); // Annulation des modifications throw new ProfilContainerException(FudaaLib.getS("Le profil couperait l'axe hydraulique en au moins deux endroits.")); } } } // Modification bas\xE9e sur l'attribut commentaire hydraulique. \\ + setAbsCurvProfilOnAxeHydraulique(_pk, cmp); GISZoneCollection zone=biefContainer_.getZoneProfils(); int idxAttrComm=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); - String comm=(String)zone.getValue(idxAttrComm, idxProfilSelected_); - zone.setAttributValue(idxAttrComm, idxProfilSelected_, GISLib.setHydroCommentDouble(comm, _value, "PK"), cmd); // Gestion de l'undo/redo if (_cmd!=null) - _cmd.addCmd(cmd.getSimplify()); + _cmd.addCmd(cmp.getSimplify()); // Retourne vrai si il faut r\xE9ordonnancer les profils if (zone.getNumGeometries()==1) return false; if (idxProfilSelected_==0) { - if (GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, 1), "PK")<_value) + if (GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, 1), "PK")<_pk) return true; } else if (idxProfilSelected_<zone.getNumGeometries()-1) { - if (GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, idxProfilSelected_-1), "PK")>_value - ||GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, idxProfilSelected_+1), "PK")<_value) + if (GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, idxProfilSelected_-1), "PK")>_pk + ||GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, idxProfilSelected_+1), "PK")<_pk) return true; } else if (idxProfilSelected_==zone.getNumGeometries()-1) - if (GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, idxProfilSelected_-1), "PK")>_value) + if (GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, idxProfilSelected_-1), "PK")>_pk) return true; return false; } Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/ExportPanel.java (from rev 4476, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueExport.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/ExportPanel.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/ExportPanel.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -0,0 +1,140 @@ +/* + * @creation 18 d\xE9c. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.modeleur1d.view; + +import java.awt.BorderLayout; +import java.io.File; + +import javax.swing.ButtonGroup; +import javax.swing.JPanel; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; + +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibFile; +import org.fudaa.ctulu.CtuluUI; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluFileChooserPanel; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.sig.FSigLib; +import org.fudaa.fudaa.tr.common.TrResource; + +import com.memoire.bu.BuFileFilter; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuRadioButton; +import com.memoire.bu.BuVerticalLayout; + +/** + * GUI de l'exporteur des donn\xE9es 1d. Il se contente de faire apparaitre une + * fen\xEAtre modale (via la m\xE9thode 'run') puis met \xE0 disposition les + * informations. Il ne fait aucun traitement par lui m\xEAme. + * + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class ExportPanel extends CtuluDialogPanel { + + private CtuluFileChooserPanel fileChooser_; + private BuRadioButton mascaret1d_; + private BuRadioButton mascaret2d_; + private CtuluUI ui_; + private BuFileFilter filtre1d_; + private BuFileFilter filtre2d_; + + public ExportPanel(CtuluUI _ui) { + ui_=_ui; + filtre1d_=new BuFileFilter("geo", FSigLib.getS("Fichier Mascaret 1d")); + filtre2d_=new BuFileFilter("georef", FSigLib.getS("Fichier Mascaret 2d")); + + setLayout(new BuVerticalLayout(5, true, true)); + final String title=FSigLib.getS("Fichier d'exportation"); + fileChooser_=new CtuluFileChooserPanel(title); + fileChooser_.setAllFileFilter(false); + fileChooser_.setWriteMode(true); + fileChooser_.setFilter(new BuFileFilter[]{filtre1d_, filtre2d_}); + fileChooser_.getTf().getDocument().addDocumentListener(new DocumentListener(){ + private void updateRb() { + // Selection automatique du checkbox correspondant \xE0 l'extension + String name=fileChooser_.getTf().getText(); + if(filtre1d_.accept(name)) + mascaret1d_.setSelected(true); + else if(filtre2d_.accept(name)) + mascaret2d_.setSelected(true); + } + public void changedUpdate(DocumentEvent e) {updateRb();} + public void insertUpdate(DocumentEvent e) {updateRb();} + public void removeUpdate(DocumentEvent e) {updateRb();} + }); + + BuLabel lbFile=new BuLabel(title); + JPanel pnFile=new JPanel(); + pnFile.setLayout(new BorderLayout(3, 3)); + pnFile.add(lbFile, BorderLayout.WEST); + pnFile.add(fileChooser_, BorderLayout.CENTER); + add(pnFile); + + mascaret1d_=new BuRadioButton("Mascaret 1d"); + add(mascaret1d_); + mascaret2d_=new BuRadioButton("Mascaret 2d"); + add(mascaret2d_); + ButtonGroup bgLayers=new ButtonGroup(); + bgLayers.add(mascaret1d_); + bgLayers.add(mascaret2d_); + mascaret2d_.doClick(); + } + + /** + * Lance l'exporter dans une fen\xEAtre modale et retourne vrai si l'utilisateur + * clic sur 'ok' \xE0 la fin, faux si il clic sur 'annuler'. + * + * @return + */ + public boolean run(){ + return CtuluDialogPanel.isOkResponse(afficheModale(this, FudaaLib.getS("Exporter les donn\xE9es de la fen\xEAtre active"))); + } + + public boolean valide() { + if (!isFileOK()) + return false; + return true; + } + + private boolean isFileOK() { + final File f=fileChooser_.getFile(); + if (f==null) { + setErrorText(CtuluLib.getS("Donnez un nom au fichier d'exportation")); + return false; + } + // Verification de l'extension + if(!filtre1d_.accept(f)&&!filtre2d_.accept(f)) { + setErrorText(TrResource.getS("Le fichier choisi a une extension inconnue")); + return false; + } + // Verification de l'\xE9crasement + if(f.exists()&&!ui_.question(CtuluLib.getS("Attention"), CtuluLib.getS("Le fichier {0} existe d\xE9j\xE0. Voulez-vous l'\xE9craser?", CtuluLibFile.getSansExtension(f.getName())))) + return false; + if (CtuluLibFile.getExtension(CtuluLibFile.getSansExtension(f.getName()))!=null) { + setErrorText(CtuluLib.getS("Ne mettez pas plusieurs '.' dans le nom.")); + return false; + } + setErrorText(null); + return true; + } + + public File getFile() { + return fileChooser_.getFile(); + } + + public boolean isMascaret1d() { + return mascaret1d_.isSelected(); + } + + public boolean isMascaret2d() { + return mascaret2d_.isSelected(); + } +} Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/OpenBiefPanel.java (from rev 4476, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueImportation.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/OpenBiefPanel.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/OpenBiefPanel.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -0,0 +1,69 @@ +/* + * @creation 12 f\xE9vr. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.modeleur1d.view; + +import javax.swing.ButtonGroup; +import javax.swing.SwingUtilities; + +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.fudaa.commun.FudaaLib; + +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuRadioButton; +import com.memoire.bu.BuVerticalLayout; + +/** + * GUI de l'importeur de donn\xE9es. Il se contente de faire apparaitre une fen\xEAtre + * modale (via la m\xE9thode 'run') puis met \xE0 disposition les informations. Il ne + * fait aucun traitement par lui m\xEAme. + * + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class OpenBiefPanel extends CtuluDialogPanel { + + private BuRadioButton rbtAxeHydrau_; + + public OpenBiefPanel() { + setLayout(new BuVerticalLayout(2, true, true)); + add(new BuLabel(FudaaLib + .getS("<html>Un axe hydraulique et des informations de type 'PK' sont disponibles et incompatibles " + +"entre elles.<br> Lequelles doivent \xEAtre choisies ?<br> Les informations non selectionn\xE9es seront d\xE9truites."))); + rbtAxeHydrau_=new BuRadioButton(FudaaLib.getS("Axe hydraulique")); + rbtAxeHydrau_.setSelected(true); + BuRadioButton rbtPK=new BuRadioButton(FudaaLib.getS("Information 'PK'")); + ButtonGroup group=new ButtonGroup(); + group.add(rbtAxeHydrau_); + group.add(rbtPK); + rbtAxeHydrau_.setHorizontalAlignment(SwingUtilities.CENTER); + rbtPK.setHorizontalAlignment(SwingUtilities.CENTER); + add(rbtAxeHydrau_); + add(rbtPK); + } + + /** + * Lance l'exporter dans une fen\xEAtre modale et retourne vrai si l'utilisateur + * clic sur 'ok' \xE0 la fin, faux si il clic sur 'annuler'. + * + * @return + */ + public boolean run() { + return CtuluDialogPanel.isOkResponse(afficheModale(this, FudaaLib.getS("Importation de donn\xE9es."))); + } + + public boolean valide() { + return true; + } + + /** + * Retourne vrai si l'utilisateur \xE0 choisie l'axe hydraulique. + */ + public boolean axeHydrauChosen() { + return rbtAxeHydrau_.isSelected(); + } +} Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestion.java (from rev 4476, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueContainerModules.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestion.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestion.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -0,0 +1,65 @@ +/* + * @creation 18 d\xE9c. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.modeleur1d.view; + +import java.awt.Container; + +import javax.swing.JComponent; +import javax.swing.ListModel; +import javax.swing.event.ListDataEvent; +import javax.swing.event.ListDataListener; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuVerticalLayout; + +/** + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class PnGestion extends JComponent implements ListDataListener { + + /** le model */ + private ListModel model_; + /** Container contenant la visualisation des modules. */ + private Container container_; + + public PnGestion(ListModel _model){ + model_=_model; + setLayout(new BuBorderLayout()); + container_=new Container(); + container_.setLayout(new BuVerticalLayout()); + add(container_, BuBorderLayout.CENTER); + model_.addListDataListener(this); + updateBox(); + } + + /** + * R\xE9g\xE9n\xE8re le contenu de la box. + */ + protected void updateBox(){ + container_.removeAll(); + for(int i=0;i<model_.getSize();i++) + if(model_.getElementAt(i) instanceof JComponent) + container_.add((JComponent) model_.getElementAt(i)); + } + + public void contentsChanged(ListDataEvent e) { + // TODO quelque chose de plus 'fin' + updateBox(); + } + + public void intervalAdded(ListDataEvent e) { + // TODO quelque chose de plus 'fin' + updateBox(); + } + + public void intervalRemoved(ListDataEvent e) { + // TODO quelque chose de plus 'fin' + updateBox(); + } +} Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionAxeHydraulique.java (from rev 4476, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionAxeHydraulique.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionAxeHydraulique.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionAxeHydraulique.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -0,0 +1,95 @@ +/* + * @creation 19 janv. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.modeleur1d.view; + +import java.awt.Container; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.modeleur.modeleur1d.controller.ControllerBief; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainer; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainerListener; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuCharValidator; +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPanel; +import com.memoire.bu.BuTextField; + +/** + * Un panneau permettant de modifier les propri\xE9t\xE9s de l'axe hydraulique. + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class PnGestionAxeHydraulique extends BuPanel{ + + /** Le controller des biefs. */ + protected ControllerBief controllerBief_; + /** D\xE9calage curviligne */ + protected BuTextField tfDecalageCurviligne_; + /** Label d\xE9calage abscisse curviligne */ + protected BuLabel lbDecalageCurviligne_; + + public PnGestionAxeHydraulique(ControllerBief _controllerBief){ + controllerBief_=_controllerBief; + setLayout(new BuBorderLayout()); + // Mise \xE0 jour lors du changement de bief selectionn\xE9 + controllerBief_.getBiefContainer().addBiefContainerListener(new BiefContainerListener() { + public void biefSelectedChanged(String name) { + biefHasChanged(); + } + public void biefSelectedRenamed(String name, String name2) {} + public void profilAdded(int profil) {} + public void profilRemoved(int profil) {} + public void profilRenamed(int profil, String name, String name2) {} + }); + // Titre + BuLabel lblTitre=new BuLabel("<html><b>"+FudaaLib.getS("Axe hydraulique")+"</b></html>"); + lblTitre.setHorizontalAlignment(BuLabel.CENTER); + add(lblTitre, BuBorderLayout.NORTH); + // Body \\ + Container body=new Container(); + body.setLayout(new BuGridLayout(2, 2, 2)); + // D\xE9calage curviligne + body.add(lbDecalageCurviligne_=new BuLabel(FudaaLib.getS("D\xE9calage abscisse: "))); + tfDecalageCurviligne_=new BuTextField(); + tfDecalageCurviligne_.setCharValidator(BuCharValidator.DOUBLE); + tfDecalageCurviligne_.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + try { + double oldvalue=controllerBief_.getBiefContainer().getDecalageAxeHydraulique(); + double newvalue=Double.parseDouble(tfDecalageCurviligne_.getText()); + if (oldvalue!=newvalue) + controllerBief_.setDebutAbscisseAxe(newvalue); + } + catch(NumberFormatException _ex) {} + } + }); + body.add(tfDecalageCurviligne_); + add(body, BuBorderLayout.CENTER); + } + + /** + * Met a jour le panneau en fonction du bief selectionn\xE9. + */ + private void biefHasChanged() { + BiefContainer bief=controllerBief_.getBiefContainer(); + if (bief.hasAxeHydraulique()) { + lbDecalageCurviligne_.setEnabled(true); + tfDecalageCurviligne_.setEnabled(true); + tfDecalageCurviligne_.setText(Double.toString(bief.getDecalageAxeHydraulique())); + } + else { + lbDecalageCurviligne_.setEnabled(false); + tfDecalageCurviligne_.setEnabled(false); + tfDecalageCurviligne_.setText(""); + } + } +} Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionBief.java (from rev 4476, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionBief.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionBief.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionBief.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -0,0 +1,189 @@ +/* + * @creation 18 d\xE9c. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.modeleur1d.view; + +import java.awt.Container; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JButton; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableModel; + +import org.fudaa.ctulu.gui.CtuluTable; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.modeleur.modeleur1d.controller.ControllerBief; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefSet; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefSetListener; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuLabel; +import com.memoire.bu.BuPanel; + +/** + * Un panneau permettant de g\xE9rer les biefs. + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class PnGestionBief extends BuPanel { + + /** Le controller des biefs. */ + protected ControllerBief controllerBief_; + /** Tableau d'affichage des biefs. */ + protected JTable tableBiefs_; + /** Bouton d'ouverture d'un bief. */ + protected BuButton btOuvrir_; + /** bouton de fusion de bief. */ + protected BuButton btFusionner_; + + public PnGestionBief(ControllerBief _controllerBief){ + controllerBief_=_controllerBief; + setLayout(new BuBorderLayout()); + // Titre + BuLabel lblTitre=new BuLabel("<html><b>"+FudaaLib.getS("Bief")+"</b></html>"); + lblTitre.setHorizontalAlignment(BuLabel.CENTER); + add(lblTitre, BuBorderLayout.NORTH); + // Body \\ + Container body=new Container(); + body.setLayout(new BuBorderLayout(2, 2)); + add(body, BuBorderLayout.CENTER); + // Tableau de noms + tableBiefs_=new CtuluTable(new TableBiefModel()); + body.add(new JScrollPane(tableBiefs_), BuBorderLayout.CENTER); + // Boutons \\ + // Ouvrir + Container btContainer=new Container(); + btContainer.setLayout(new BuGridLayout(1, 5, 5)); + btOuvrir_=new BuButton(FudaaLib.getS("Ouvrir")); + btOuvrir_.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + controllerBief_.getBiefSelectionModel().setSelectedBief(tableBiefs_.getSelectionModel().getMinSelectionIndex()); + } + }); + tableBiefs_.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + ListSelectionModel sel=tableBiefs_.getSelectionModel(); + if(sel.getMaxSelectionIndex()!=sel.getMinSelectionIndex()||sel.getMaxSelectionIndex()==-1) + btOuvrir_.setEnabled(false); + else + btOuvrir_.setEnabled(true); + } + }); + btOuvrir_.setEnabled(false); + btContainer.add(btOuvrir_); + // Supprimer + JButton btSupprimer=new BuButton(FudaaLib.getS("supprimer")); + btSupprimer.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + // R\xE9cup\xE9ration des biefs selectionn\xE9s + List<Integer> idxSupp=new ArrayList<Integer>(); + for(int i=tableBiefs_.getModel().getRowCount()-1;i>=0;i--) + if(tableBiefs_.getSelectionModel().isSelectedIndex(i)) + idxSupp.add(i); + int[] idx=new int[idxSupp.size()]; + for(int i=0;i<idx.length;i++) + idx[i]=idxSupp.get(i); + // Suppression des biefs + controllerBief_.removeBief(idx); + } + }); + btContainer.add(btSupprimer); + // Fusionner + btFusionner_=new BuButton(FudaaLib.getS("Fusionner")); + btFusionner_.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + ListSelectionModel sel=tableBiefs_.getSelectionModel(); + controllerBief_.fusionnerBiefs(sel.getMinSelectionIndex(), sel.getMaxSelectionIndex()); + } + }); + tableBiefs_.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + int nbSel=0; + for(int i=tableBiefs_.getModel().getRowCount();i>=0;i--) + if(tableBiefs_.getSelectionModel().isSelectedIndex(i)) + nbSel++; + if(nbSel!=2) + btFusionner_.setEnabled(false); + else + btFusionner_.setEnabled(true); + } + }); + btFusionner_.setEnabled(false); + btContainer.add(btFusionner_); + // Dupliquer + JButton btDupliquer=new BuButton(FudaaLib.getS("Dupliquer")); + btDupliquer.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + controllerBief_.dupliquerSelectedBief(); + } + }); + btDupliquer.setEnabled(false); + btContainer.add(btDupliquer); + body.add(btContainer, BuBorderLayout.EAST); + body.setPreferredSize(body.getMinimumSize()); + } + + /** + * Surcharge du model du tableau pour prendre les informations directement dans le BiefSet. + */ + private class TableBiefModel extends DefaultTableModel implements BiefSetListener { + + /** Raccourcis vers le biefSet. */ + private BiefSet biefSet_; + + public TableBiefModel() { + super(new String[]{FudaaLib.getS("Nom")}, 0); + biefSet_=controllerBief_.getBiefSet(); + biefSet_.addBiefSetListener(this); + } + + public Class<?> getColumnClass(int columnIndex) { + return String.class; + } + + public int getRowCount() { + if(biefSet_==null) + return 0; + return biefSet_.getNbBief(); + } + + public Object getValueAt(int rowIndex, int columnIndex) { + return biefSet_.getBiefName(rowIndex); + } + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return true; + } + + public void setValueAt(Object value, int rowIndex, int columnIndex) { + if(!getValueAt(rowIndex, columnIndex).equals(value)) + controllerBief_.renameBief((String) getValueAt(rowIndex, columnIndex), (String) value); + } + + public void addedBief(String name) { + fireTableDataChanged(); + } + + public void removedBief(String name) { + fireTableDataChanged(); + } + + public void renamedBief(String name, String name2) { + fireTableDataChanged(); + } + + } +} Copied: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionProfil.java (from rev 4476, branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionProfil.java) =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionProfil.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/PnGestionProfil.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -0,0 +1,156 @@ +/* + * @creation 18 d\xE9c. 2008 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.modeleur1d.view; + +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.event.ListSelectionEvent; +import javax.swing.table.DefaultTableModel; + +import org.fudaa.ctulu.gui.CtuluTable; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.modeleur.modeleur1d.controller.ControllerProfil; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainer; +import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainerListener; + +import com.memoire.bu.BuBorderLayout; +import com.memoire.bu.BuButton; +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuLabel; + +/** + * Un panneau permettant de g\xE9rer les profils. + * @author Emmanuel MARTIN + * @version $Id$ + */ +public class PnGestionProfil extends JPanel { + + /** Le controller des profils. */ + protected ControllerProfil controllerProfil_; + /** Tableau d'affichage des biefs. */ + protected JTable tableProfils_; + + public PnGestionProfil(ControllerProfil _controllerProfil){ + controllerProfil_=_controllerProfil; + setLayout(new BuBorderLayout()); + // Titre + BuLabel lblTitre=new BuLabel("<html><b>"+FudaaLib.getS("Profil")+"</b></html>"); + lblTitre.setHorizontalAlignment(BuLabel.CENTER); + add(lblTitre, BuBorderLayout.NORTH); + // Body \\ + Container body=new Container(); + body.setLayout(new BuBorderLayout(2, 2)); + add(body, BuBorderLayout.CENTER); + // Tableau de noms + tableProfils_=new CtuluTable(new TableProfilModel()) { + /* (non-Javadoc) + * @see javax.swing.JTable#valueChanged(javax.swing.event.ListSelectionEvent) + */ + @Override + public void valueChanged(ListSelectionEvent e) { + super.valueChanged(e); + scrollRectToVisible(getCellRect(getSelectionModel().getMaxSelectionIndex(), 0, false)); + } + }; + tableProfils_.setSelectionModel(controllerProfil_.getProfilSelectionModel()); + body.add(new JScrollPane(tableProfils_), BuBorderLayout.CENTER); + // Boutons + Container btContainer=new Container(); + btContainer.setLayout(new BuGridLayout(1, 5, 5)); + JButton btAjout=new BuButton(FudaaLib.getS("Ajout")); + btAjout.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + controllerProfil_.ajoutProfil(); + } + }); + btAjout.setEnabled(false); + btContainer.add(btAjout); + JButton btSupprimer=new BuButton(FudaaLib.getS("supprimer")); + btSupprimer.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + controllerProfil_.supprimerSelectedProfil(); + } + }); + btContainer.add(btSupprimer); + JButton btFusionner=new BuButton(FudaaLib.getS("Fusionner")); + btFusionner.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + controllerProfil_.fusionnerProfil(); + } + }); + btFusionner.setEnabled(false); + btContainer.add(btFusionner); + body.add(btContainer, BuBorderLayout.EAST); + body.setPreferredSize(new Dimension(body.getMinimumSize().width, 350)); + } + + /** + * Surcharge du model du tableau pour prendre les informations directement dans le BiefSet. + */ + private class TableProfilModel extends DefaultTableModel implements BiefContainerListener { + + /** Raccourcis vers le biefContainer. */ + private BiefContainer biefContainer_; + + public TableProfilModel() { + super(new String[]{FudaaLib.getS("Nom")}, 0); + biefContainer_=controllerProfil_.getBiefContainer(); + biefContainer_.addBiefContainerListener(this); + } + + public Class<?> getColumnClass(int columnIndex) { + return String.class; + } + + public int getRowCount() { + if(biefContainer_==null) + return 0; + return biefContainer_.getNbProfil(); + } + + public Object getValueAt(int rowIndex, int columnIndex) { + return biefContainer_.getNomProfil(rowIndex); + } + + public boolean isCellEditable(int rowIndex, int columnIndex) { + return true; + } + + public void setValueAt(Object value, int rowIndex, int columnIndex) { + if(!getValueAt(rowIndex, columnIndex).equals(value)) + controllerProfil_.renameProfil(rowIndex, (String) value); + } + + public void biefSelectedChanged(String name) { + fireTableDataChanged(); + } + + public void biefSelectedRenamed(String name, String name2) { + fireTableDataChanged(); + } + + public void profilRemoved(int profil) { + fireTableDataChanged(); + } + + public void profilRenamed(int profil, String name, String name2) { + fireTableDataChanged(); + } + + public void profilAdded(int profil) { + fireTableDataChanged(); + } + } +} Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueContainerModules.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueContainerModules.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueContainerModules.java 2009-02-16 21:23:26 UTC (rev 4477) @@ -1,65 +0,0 @@ -/* - * @creation 18 d\xE9c. 2008 - * @modification $Date:$ - * @license GNU General Public License 2 - * @copyright (c)1998-2008 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail fud...@li... - */ -package org.fudaa.fudaa.modeleur.modeleur1d.view; - -import java.awt.Container; - -import javax.swing.JComponent; -import javax.swing.ListModel; -import javax.swing.event.ListDataEvent; -import javax.swing.event.ListDataListener; - -import com.memoire.bu.BuBorderLayout; -import com.memoire.bu.BuVerticalLayout; - -/** - * @author Emmanuel MARTIN - * @version $Id$ - */ -public class VueContainerModules extends JComponent implements ListDataListener { - - /** le model */ - private ListModel model_; - /** Container contenant la visualisation des modules. */ - private Container container_; - - public VueContainerModules(ListModel _model){ - model_=_model; - setLayout(new BuBorderLayout()); - container_=new Container(); - container_.setLayout(new BuVerticalLayout()); - add(container_, BuBorderLayout.CENTER); - model_.addListDataListener(this); - updateBox(); - } - - /** - * R\xE9g\xE9n\xE8re le contenu de la box. - */ - protected void updateBox(){ - container_.removeAll(); - for(int i=0;i<model_.getSize();i++) - if(model_.getElementAt(i) instanceof JComponent) - container_.add((JComponent) model_.getElementAt(i)); - } - - public void contentsChanged(ListDataEvent e) { - // TODO quelque chose de plus 'fin' - updateBox(); - } - - public void intervalAdded(ListDataEvent e) { - // TODO quelque chose de plus 'fin' - updateBox(); - } - - public void intervalRemoved(ListDataEvent e) { - // TODO quelque chose de plus 'fin' - updateBox(); - } -} Deleted: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueExport.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueExport.java 2009-02-16 17:11:11 UTC (rev 4476) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueExport.java 2009-... [truncated message content] |
From: <had...@us...> - 2009-02-16 17:11:17
|
Revision: 4476 http://fudaa.svn.sourceforge.net/fudaa/?rev=4476&view=rev Author: hadouxad Date: 2009-02-16 17:11:11 +0000 (Mon, 16 Feb 2009) Log Message: ----------- # Ajout de l'exportation ps # Ajout des tickiterator unique numberiterator pour les graphe et gestion des modes manuels . # gestion de la r?\195?\169cup?\195?\169ration des points des calque de la vue 2d pour l'assistant des ?\195?\169vol temporelles (cf visualisateur pour les profils spatiaux) Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-2.1.4.jar branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-src-2.1.4.zip branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrEvolutionBuilderFromTree.java Added: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-2.1.4.jar =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-2.1.4.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-src-2.1.4.zip =================================================================== (Binary files differ) Property changes on: branches/Prepro-0.92-SNAPSHOT/ctulu/lib/iText-src-2.1.4.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -6,6 +6,7 @@ import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; import java.awt.print.PageFormat; +import java.awt.print.Paper; import java.awt.print.Printable; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; @@ -109,56 +110,57 @@ } + + public static class PrintableObject implements Printable{ - BufferedImage image_; - public PrintableObject(BufferedImage img){ - image_=img; - } - public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) - throws PrinterException { - graphics.drawImage(image_,0,0,null); - return 0; - } + BufferedImage image_; + public PrintableObject(BufferedImage img){ + image_=img; + } + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) + throws PrinterException { + // graphics.drawImage(image_,0,0,image_.getWidth(),image_.getHeight(),null); + + graphics.drawImage(image_,0,0,(int)pageFormat.getWidth(),(int)pageFormat.getHeight(),null); + return 0; + } } - - /** - *Un lecteur ps - *@author Adrien Hadoux - */ - public static void writePostScript(final RenderedImage _image, final File _targetFile, final String _format) throws Exception{ - -// PrintableObject objectToPrint=new PrintableObject((BufferedImage) _image); -// -// -// PrinterJob job = PrinterJob.getPrinterJob(); -// job.setPrintable(objectToPrint); -// -// String psMimeType = "application/postscript"; -// FileOutputStream outstream; -// StreamPrintService psPrinter=null; -// StreamPrintServiceFactory []spsFactories = -// PrinterJob.lookupStreamPrintServices(psMimeType); -// if (spsFactories.length > 0) { -// try { -// outstream = new FileOutputStream(_targetFile); -// psPrinter = spsFactories[0].getPrintService(outstream); -// // psPrinter can now be set as the service on a PrinterJob -// } catch (FileNotFoundException e) { -// throw e; -// } -// } -// -// -// -// job.setPrintService(psPrinter); // if app wants to specify this printer. -// PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); -// aset.add(new Copies(1)); -// -// -// -// job.print(aset); + +/** + *Un lecteur ps + *@author Adrien Hadoux + */ +public static void writePostScript(final RenderedImage _image, final File _targetFile, final String _format) throws Exception{ + PrintableObject objectToPrint=new PrintableObject((BufferedImage) _image); + PrinterJob job = PrinterJob.getPrinterJob(); + PageFormat format=new PageFormat(); + Paper paper=new Paper(); + paper.setSize(_image.getWidth(),_image.getHeight()); + paper.setImageableArea(0,0, _image.getWidth(), _image.getHeight()); + format.setPaper(paper); + job.setPrintable(objectToPrint,format); + + String psMimeType = "application/postscript"; + FileOutputStream outstream; + StreamPrintService psPrinter=null; + StreamPrintServiceFactory []spsFactories = + PrinterJob.lookupStreamPrintServices(psMimeType); + if (spsFactories.length > 0) { + try { + outstream = new FileOutputStream(_targetFile); + psPrinter = spsFactories[0].getPrintService(outstream); + // psPrinter can now be set as the service on a PrinterJob + } catch (FileNotFoundException e) { + throw e; } + } + job.setPrintService(psPrinter); // if app wants to specify this printer. + PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); + aset.add(new Copies(1)); + job.print(aset); + } + Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGISTreeModel.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -167,9 +167,9 @@ if (_userObject instanceof ZCalqueMultiPoint) { icon_ = EbliResource.EBLI.getIcon("draw-multipoint"); } -// else if (_userObject instanceof ZCalquePoint) { -// icon_ = EbliResource.EBLI.getIcon("draw-add-pt"); -// } + else if (_userObject instanceof ZCalquePoint) { + icon_ = EbliResource.EBLI.getIcon("draw-add-pt"); + } else { if (((ZCalqueLigneBrisee)_userObject).getModele().isGeometryFermee(_idx)) { icon_=EbliResource.EBLI.getIcon("draw-polygon"); @@ -273,7 +273,7 @@ } void addGeometries(final LayerNode _parent, final ZCalqueAffichageDonneesAbstract _cq) { - final GISZoneCollection collec = ((ZModeleGeom)_cq.modeleDonnees()).getGeomData(); + final GISZoneCollection collec = ((ZModeleGeom)_cq.modeleDonnees()).getGeomData(); final GISAttributeModelObjectInterface nameAtt = (GISAttributeModelObjectInterface) collec.getModel(GISAttributeConstants.TITRE); final int nb = collec.getNumGeometries(); for (int i = 0; i < nb; i++) { @@ -286,10 +286,10 @@ badd=true; name="Multipoint {0}"; } -// else if (chooser_.isPt() && (finder_.getMask()&GISLib.MASK_POINT)!=0) { -// badd=true; -// name="Point {0}"; -// } + else if (chooser_.isPt() && (finder_.getMask()&GISLib.MASK_POINT)!=0) { + badd=true; + name="Point {0}"; + } else if (chooser_.isPolyligne() && (finder_.getMask()&GISLib.MASK_POLYLINE)!=0) { badd=true; name="Ligne ouverte {0}"; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/CalqueGeometryVisitor.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -55,9 +55,11 @@ if (_cq instanceof ZCalqueMultiPoint && (mask_&GISLib.MASK_MULTIPOINT)!=0) { return ((ZCalqueMultiPoint)_cq).modeleDonnees().getNombre() > 0; } -// else if (_cq instanceof ZCalquePoint && (mask_&GISLib.MASK_POINT)!=0) { -// return ((ZCalquePoint) _cq).modeleDonnees().getNombre() > 0; -// } + //-- rajout du test si le modele implements ZModeleGeom car c'est automatiquement cast\xE9 dans addGeometry sans v\xE9rification pr\xE9alable --// + //-- or c'est pas bon pour le calque des Noeuds ...--// + else if (_cq instanceof ZCalquePoint && (mask_&GISLib.MASK_POINT)!=0 && ((ZCalquePoint) _cq).modeleDonnees() instanceof ZModeleGeom) { + return ((ZCalquePoint) _cq).modeleDonnees().getNombre() > 0; + } else if (_cq instanceof ZCalqueLigneBrisee && (mask_&GISLib.MASK_POLYLINE)!=0) { boolean bok=((ZCalqueLigneBrisee) _cq).modeleDonnees().getNombre() > 0; return bok && ((ZCalqueLigneBrisee)_cq).getModele().getNbLigneBrisee()!=0; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalquePoint.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -405,6 +405,14 @@ } return -1; } + + public GrPoint getPoint( int i){ + if(i>= modeleDonnees().getNombre()) + return null; + GrPoint p=new GrPoint(); + modele().point(p, i, true); + return p; + } protected CtuluListSelection selectionBasic(final GrPoint _pt, final int _tolerance) { if (modele().getNombre() == 0 || (!isVisible())) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxe.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxe.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -17,13 +17,13 @@ import org.fudaa.ctulu.gui.CtuluValueEditorI; import org.fudaa.ctulu.iterator.LogarithmicNumberIterator; import org.fudaa.ctulu.iterator.NumberIterator; -import org.fudaa.ctulu.iterator.NumberIteratorGraduationsFixe; -import org.fudaa.ctulu.iterator.NumberIteratorPasFixe; + import org.fudaa.ctulu.iterator.TickIterator; import org.fudaa.ebli.controle.BSelecteurCheckBox; import org.fudaa.ebli.controle.BSelecteurColorChooser; import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; import org.fudaa.ebli.controle.BSelecteurTextField; +import org.fudaa.ebli.geometrie.GrBoite; import org.fudaa.ebli.trace.TraceLigne; import org.fudaa.ebli.trace.TraceLigneModel; @@ -79,10 +79,10 @@ Color lineColor_; - public static int MANUEL_GRADUATIONS=999; - public static int MANUEL_LONGUEURPAS=888; - public static int AUTO_GRADUATIONS=0; - public static int AUTO_LONGUEURPAS=1; + public static int MANUEL_GRADUATIONS=0; + public static int MANUEL_LONGUEURPAS=1; + public static int AUTO_GRADUATIONS=2; + public static int AUTO_LONGUEURPAS=3; /** @@ -192,27 +192,33 @@ return null; } + /** + * nombre de sous graduations + */ + int nbSousGraduations_=3; + final TickIterator buildUpToDateMainTickIterator() { - // if (axisIterator_ == null) { - - /*if(modeGraduations_==MANUEL_GRADUATIONS ){ - axisIterator_ = new NumberIteratorGraduationsFixe(); - axisIterator_.init(getMinimum(), getMaximum(), nbPas_); - } - else - if(modeGraduations_==MANUEL_LONGUEURPAS){ - axisIterator_ = new NumberIteratorPasFixe(); - axisIterator_.init(getMinimum(), getMaximum(), longueurPas_); - } - else if(modeGraduations_==AUTO_GRADUATIONS){ - + + axisIterator_ = new NumberIterator(); + ((NumberIterator)axisIterator_).setMaxFractionDigits(2); - }else*/ if(modeGraduations_==AUTO_LONGUEURPAS){ - axisIterator_ = new NumberIterator(); + + double min=getMinimum(); + double max=getMaximum(); + int mode=modeGraduations_; + + if(modeGraduations_==MANUEL_GRADUATIONS ){ + axisIterator_.initExact(getMinimum(),getMaximum(), nbPas_, nbSousGraduations_+1); + }else + if(modeGraduations_==MANUEL_LONGUEURPAS ){ + axisIterator_.initExactFromDist(getMinimum(),getMaximum(), longueurPas_, nbSousGraduations_+1); + }else + if(modeGraduations_==AUTO_LONGUEURPAS){ + axisIterator_.init(getMinimum(), getMaximum(), (int)( (getMaximum()-getMinimum())/longueurPas_)); } else{ - axisIterator_ = new NumberIterator(); + axisIterator_.init(getMinimum(), getMaximum(), nbPas_); } if (FuLog.isDebug() && Fu.DEBUG) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontal.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -11,6 +11,7 @@ import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; +import java.util.ArrayList; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluNumberFormatDefault; @@ -84,10 +85,16 @@ final boolean grille = isGrille(); int idx = 0; TickIterator iterator = buildUpToDateMainTickIterator(); + ArrayList<Double> vals=new ArrayList<Double>(); + for (final TickIterator it = iterator; it.hasNext() && idx < 300; it.next()) { idx++; _g.setColor(lightfg); - final int xe = _f.getXEcran(it.currentValue()); + double val=it.currentValue(); + final int xe = _f.getXEcran(val); + + vals.add(new Double(val)); + if (graduations_) { if (it.isMajorTick()) { if (specificFormat_ == null) { @@ -129,6 +136,9 @@ grille_.dessineTrait(_g, xe, y, xe, _f.getMinEcranY()); } } + + vals.trimToSize(); + /* * t = getStringAffiche(maximum); int xe = _f.getXEcran(maximum); double * xLeft = xe - fm.stringWidth(t) / 2; if (xLeft > (lastMaxX + 2)) { @@ -370,6 +380,17 @@ .getFont().getSize())); duplic.setTitre(this.getTitre()); + duplic.graduations_=graduations_; + duplic.longueurPas_=longueurPas_; + duplic.modeGraduations_=modeGraduations_; + duplic.nbPas_=nbPas_; + duplic.nbSousGraduations_=nbSousGraduations_; + //duplic.range_=new CtuluRange(range_); + duplic.traceGraduations_=new TraceLigneModel(traceGraduations_); + duplic.traceSousGraduations_=new TraceLigneModel(traceSousGraduations_); + duplic.traceGrille_=traceGrille_; + duplic.traceSousGrille_=traceSousGrille_; + duplic.nbSousGraduations_=nbSousGraduations_; return duplic; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -48,7 +48,7 @@ * le mode de graduation */ int modeGraduations_; - + int nbSousGraduations_; public EGAxeHorizontalPersist(EGAxeHorizontal axeX) { // TODO Auto-generated constructor stub fillInfoWith(axeX); @@ -73,7 +73,7 @@ nbPas_=axeX.nbPas_; longueurPas_=axeX.longueurPas_; modeGraduations_=axeX.modeGraduations_; - + nbSousGraduations_=axeX.nbSousGraduations_; } public EGAxeHorizontal generateAxe(){ @@ -96,6 +96,7 @@ axeX.nbPas_=nbPas_; axeX.longueurPas_=longueurPas_; axeX.modeGraduations_=modeGraduations_; + axeX.nbSousGraduations_=nbSousGraduations_; return axeX; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -81,12 +81,13 @@ private BuTextField tfHorPas_; + private BuTextField tfHorSousPas_; + - private JComponent tfVertMax_; private JComponent tfVertMin_; private BuTextField tfVertPas_; - + private BuTextField tfVertSousPas_; EGObject[] targets_; public EGAxeRepereConfigurator(final EGGraphe _m) { @@ -171,12 +172,20 @@ tfVertMax_.setToolTipText(tooltipTxt); tfVertMin_.setToolTipText(tooltipTxt); if (tfVertPas_ == null) { - tfVertPas_ = BuTextField.createIntegerField(); + tfVertPas_ = BuTextField.createDoubleField(); tfVertPas_.setToolTipText(tooltipPas); tfVertPas_.setValueValidator(tfHorPas_.getValueValidator()); tfVertPas_.setColumns(10); tfVertPas_.addKeyListener(this); } + + if (tfVertSousPas_ == null) { + tfVertSousPas_ = BuTextField.createIntegerField(); + tfVertSousPas_.setToolTipText(tooltipPas); + tfVertSousPas_.setValueValidator(BuValueValidator.INTEGER); + tfVertSousPas_.setColumns(10); + tfVertSousPas_.addKeyListener(this); + } // vertical min BuLabel lb = new BuLabel(minTxt); lb.setToolTipText(EbliLib.getS("Borne inf\xE9rieure des axes verticaux")); @@ -194,31 +203,42 @@ //-- selection du type de graduations - final BuComboBox combo = new BuComboBox(new String[] { /*EbliLib.getS("Manuel: Nb graduations"), - EbliLib.getS("Manuel: longueur des pas"),*/ EbliLib.getS(/*"Automatique:*/" Nb graduations"), - EbliLib.getS(/*"Automatique:*/" Longueur des pas") }); + comboVertical_ = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nombre de graduations"), + EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"), + EbliLib.getS("Automatique: Longueur des pas") }); - pnAxeV_.add(combo); + pnAxeV_.add(comboVertical_); pnAxeV_.add(tfVertPas_); + + pnAxeV_.add(new JLabel(EbliResource.EBLI.getString("Sous graduations:"))); + pnAxeV_.add(tfVertSousPas_); //-- listener de la combo --// - combo.addActionListener(new ActionListener() { + comboVertical_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - modeGraduationY_=combo.getSelectedIndex(); - graphe_.axeUpdated(); + modeGraduationY_=comboVertical_.getSelectedIndex(); + if(modeGraduationY_==EGAxe.AUTO_GRADUATIONS|| modeGraduationY_==EGAxe.AUTO_LONGUEURPAS) + tfVertSousPas_.setEnabled(false); + else + tfVertSousPas_.setEnabled(true); + EGAxe axeChoisi=null; if(graphe_.getSelectedComponent()!=null) axeChoisi=graphe_.getSelectedComponent().getAxeY(); if(axeChoisi==null && axes_!=null && axes_.length>0) axeChoisi=axes_[0]; - if(axeChoisi!=null) - if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + if(axeChoisi!=null){ + if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS || axeChoisi.modeGraduations_==EGAxe.MANUEL_GRADUATIONS) tfVertPas_.setText(""+axeChoisi.nbPas_); else - if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS || axeChoisi.modeGraduations_==EGAxe.MANUEL_LONGUEURPAS) tfVertPas_.setText(""+axeChoisi.longueurPas_); + axeChoisi.modeGraduations_=modeGraduationY_; + + } + graphe_.axeUpdated(); } }); @@ -231,10 +251,10 @@ axeChoisi=axes_[0]; if(axeChoisi!=null) - if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS || axeChoisi.modeGraduations_==EGAxe.MANUEL_GRADUATIONS) tfVertPas_.setText(""+axeChoisi.nbPas_); else - if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS || axeChoisi.modeGraduations_==EGAxe.MANUEL_LONGUEURPAS) tfVertPas_.setText(""+axeChoisi.longueurPas_); @@ -364,15 +384,22 @@ tfHorPas_.setToolTipText(tooltipPas); tfHorPas_.addKeyListener(this); - if(axeH_.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + if(axeH_.modeGraduations_==EGAxe.AUTO_GRADUATIONS || modeGraduationX_==EGAxe.MANUEL_GRADUATIONS) tfHorPas_.setText(""+axeH_.nbPas_); else - if(axeH_.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + if(axeH_.modeGraduations_==EGAxe.AUTO_LONGUEURPAS || modeGraduationX_==EGAxe.MANUEL_LONGUEURPAS) tfHorPas_.setText(""+axeH_.longueurPas_); } - + if (tfHorSousPas_ == null) { + tfHorSousPas_ = BuTextField.createIntegerField(); + tfHorSousPas_.setValueValidator(BuValueValidator.INTEGER); + tfHorSousPas_.setColumns(10); + tfHorSousPas_.setToolTipText(tooltipPas); + tfHorSousPas_.addKeyListener(this); + + } tfHorMax_.addKeyListener(this); tfHorMin_.addKeyListener(this); @@ -391,9 +418,9 @@ //-- selection du type de graduations if(comboHorizontal_==null){ - comboHorizontal_= new BuComboBox(new String[] { /*EbliLib.getS("Manuel: Nb graduations"), - EbliLib.getS("Manuel: longueur des pas"),*/ EbliLib.getS(/*"Automatique:*/" Nb graduations"), - EbliLib.getS(/*"Automatique:*/" Longueur des pas") }); + comboHorizontal_= new BuComboBox(new String[] { EbliLib.getS("Manuel: Nombre de graduations"), + EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"), + EbliLib.getS("Automatique: Longueur des pas") }); lb = new BuLabel(typePasTxt); //pnAxeH_.add(lb); //-- listener de la combo --// @@ -401,11 +428,18 @@ public void actionPerformed(ActionEvent e) { modeGraduationX_=comboHorizontal_.getSelectedIndex(); - if(modeGraduationX_==EGAxe.AUTO_GRADUATIONS) + if(modeGraduationX_==EGAxe.AUTO_GRADUATIONS ||modeGraduationX_==EGAxe.AUTO_LONGUEURPAS) + tfHorSousPas_.setEnabled(false); + else + tfHorSousPas_.setEnabled(true); + + if(modeGraduationX_==EGAxe.AUTO_GRADUATIONS || modeGraduationX_==EGAxe.MANUEL_GRADUATIONS) tfHorPas_.setText(""+axeH_.nbPas_); else - if(modeGraduationX_==EGAxe.AUTO_LONGUEURPAS) + if(modeGraduationX_==EGAxe.AUTO_LONGUEURPAS || modeGraduationX_==EGAxe.MANUEL_LONGUEURPAS) tfHorPas_.setText(""+axeH_.longueurPas_); + int mode=modeGraduationX_; + axeH_.modeGraduations_=modeGraduationX_; graphe_.axeUpdated(); } @@ -419,7 +453,7 @@ boxAfficheGraduationsX_.setSelected(axeH_.traceGrille_); boxAfficheGraduationsX_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { - + modeGraduationX_=comboHorizontal_.getSelectedIndex(); apply(); } }); @@ -432,6 +466,11 @@ }); // pnAxeH_.add(choixType); pnAxeH_.add(tfHorPas_); + + + pnAxeH_.add(new JLabel(EbliResource.EBLI.getString("Sous graduations:"))); + pnAxeH_.add(tfHorSousPas_); + //-- graduations --// modelGraduationsX_ = new BSelecteurLineModel(GRILLE_AXE_X,axeH_.traceGraduations_); @@ -470,16 +509,23 @@ private boolean applyHorizontal() { final String pas = tfHorPas_.getText().trim(); + final String Souspas = tfHorSousPas_.getText().trim(); + final boolean maxEdited = editorH_.isValueValidFromComponent(tfHorMax_); final boolean minEdited = editorH_.isValueValidFromComponent(tfHorMin_); - final boolean pasEdited = pas.length() > 0; + boolean pasEdited = pas.length() > 0; + if(!pasEdited) + pasEdited=Souspas.length()>0; + final double maxVal = maxEdited ? Double.parseDouble(editorH_.getStringValue(tfHorMax_)) : axeH_.getMaximum(); final double minVal = minEdited ? Double.parseDouble(editorH_.getStringValue(tfHorMin_)) : axeH_.getMinimum(); final double pasVal = pasEdited ? Double.parseDouble(pas) : 0; + final int souspasVal = (Souspas.length()>0) ? Integer.parseInt(Souspas) : 0; + boolean r = false; + if(comboHorizontal_.getSelectedIndex()!=-1) + axeH_.modeGraduations_=comboHorizontal_.getSelectedIndex(); - - if (maxEdited || minEdited || pasEdited) { if (pasEdited) { if(modeGraduationX_==EGAxe.MANUEL_GRADUATIONS || modeGraduationX_==EGAxe.AUTO_GRADUATIONS) @@ -491,6 +537,12 @@ r = axeH_.setBounds(minVal, maxVal,-1,modeGraduationX_); } + if(Souspas.length()>0){ + if(souspasVal!=axeH_.nbSousGraduations_) + r=true; + axeH_.nbSousGraduations_=souspasVal; + + } } TraceLigneModel model=modelGraduationsX_.getNewData(); @@ -551,12 +603,24 @@ } } final String pas = tfVertPas_.getText().trim(); + final String Souspas = tfVertSousPas_.getText().trim(); + + boolean pasModif = pas.length() > 0; - final boolean pasModif = pas.length() > 0; - + if(!pasModif) + pasModif=Souspas.length()>0; + if (maxEdited || minEdited || pasModif) { final double pasVal = pasModif ? Double.parseDouble(pas) : 0; for (int i = 0; i < axes_.length; i++) { + + if(comboVertical_.getSelectedIndex()!=-1) + axes_[i].modeGraduations_=comboVertical_.getSelectedIndex(); + + final int pasSousVal = (Souspas.length()>0) ? Integer.parseInt(Souspas) : 0; + + + double min = minVal; double max = maxVal; if (!minEdited) { @@ -595,7 +659,12 @@ r=true; } + if((Souspas.length()>0)){ + if(axes_[i].nbSousGraduations_!=pasSousVal) + r=true; + axes_[i].nbSousGraduations_=pasSousVal; + } } } @@ -697,7 +766,13 @@ void updateAxeHorValue() { editorH_.setValue(CtuluLib.getDouble(axeH_.getMaximum()), tfHorMax_); editorH_.setValue(CtuluLib.getDouble(axeH_.getMinimum()), tfHorMin_); - tfHorPas_.setText(CtuluLibString.getString(axeH_.getNbPas())); + if(axeH_.modeGraduations_==EGAxe.AUTO_GRADUATIONS|| axeH_.modeGraduations_==EGAxe.MANUEL_GRADUATIONS) + tfHorPas_.setText(CtuluLibString.getString(axeH_.getNbPas())); + else + tfHorPas_.setText(""+axeH_.longueurPas_); + + tfHorSousPas_.setText(""+axeH_.nbSousGraduations_); + cbBlockHView_.setSelected(false); cbUnblockBlockHView_.setSelected(false); cbUnblockBlockHView_.setEnabled(graphe_.isUserXRangeSet()); @@ -709,13 +784,17 @@ String min = CtuluLibString.EMPTY_STRING; String max = min; String pas = min; + String longueurPas=""; if (axes_ != null && axes_.length > 0) { boolean minIsCommon = true; boolean maxIsCommon = true; boolean pasIsCommon = true; + + final double commonMin = axes_[0].getMinimum(); final double commonMax = axes_[0].getMaximum(); final int commonPas = axes_[0].getNbPas(); + final double commonLongueurPas=axes_[0].longueurPas_; for (int i = 1; i < axes_.length && (minIsCommon || maxIsCommon || pasIsCommon); i++) { if (axes_[i].getMinimum() != commonMin) { minIsCommon = false; @@ -726,6 +805,9 @@ if (axes_[i].getNbPas() != commonPas) { pasIsCommon = false; } + if (axes_[i].getNbPas() != commonPas) { + pasIsCommon = false; + } } if (minIsCommon) { min = Double.toString(commonMin); @@ -734,14 +816,23 @@ max = Double.toString(commonMax); } if (pasIsCommon) { + longueurPas=""+commonLongueurPas; pas = CtuluLibString.getString(commonPas); } + if(axes_[0].modeGraduations_==EGAxe.AUTO_GRADUATIONS|| axes_[0].modeGraduations_==EGAxe.MANUEL_GRADUATIONS) + tfVertPas_.setText(pas); + else + tfVertPas_.setText(longueurPas); + tfVertSousPas_.setText(""+axes_[0].nbSousGraduations_); } if (editorV_ != null) { editorV_.setValue(max, tfVertMax_); editorV_.setValue(min, tfVertMin_); } - tfVertPas_.setText(pas); + + + + updateAxeHorValue(); cbUseSameAxe_.setEnabled(axes_ != null && axes_.length > 1); cbUseSameAxe_.setSelected(false); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVertical.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -17,6 +17,7 @@ import org.fudaa.ctulu.CtuluRange; import org.fudaa.ctulu.iterator.TickIterator; import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; import com.memoire.fu.Fu; import com.memoire.fu.FuLog; @@ -378,6 +379,18 @@ duplic.setFont(new Font(this.getFont().getFamily(),this.getFont().getStyle(),this.getFont().getSize())); duplic.setTitre(this.getTitre()); + + duplic.graduations_=graduations_; + duplic.longueurPas_=longueurPas_; + duplic.modeGraduations_=modeGraduations_; + duplic.nbPas_=nbPas_; + duplic.nbSousGraduations_=nbSousGraduations_; + //duplic.range_=new CtuluRange(range_); + duplic.traceGraduations_=new TraceLigneModel(traceGraduations_); + duplic.traceSousGraduations_=new TraceLigneModel(traceSousGraduations_); + duplic.traceGrille_=traceGrille_; + duplic.traceSousGrille_=traceSousGrille_; + duplic.nbSousGraduations_=nbSousGraduations_; return duplic; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -52,6 +52,8 @@ */ int modeGraduations_; + int nbSousGraduations_; + public EGAxeVerticalPersist(EGAxeVertical axeY) { // TODO Auto-generated constructor stub fillInfoWith(axeY); @@ -79,6 +81,7 @@ nbPas_=axeY.nbPas_; longueurPas_=axeY.longueurPas_; modeGraduations_=axeY.modeGraduations_; + nbSousGraduations_=axeY.nbSousGraduations_; } @@ -106,7 +109,7 @@ axeY.nbPas_=nbPas_; axeY.longueurPas_=longueurPas_; axeY.modeGraduations_=modeGraduations_; - + axeY.nbSousGraduations_=nbSousGraduations_; return axeY; } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrEvolutionBuilderFromTree.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrEvolutionBuilderFromTree.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrEvolutionBuilderFromTree.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -0,0 +1,257 @@ +package org.fudaa.fudaa.tr.post; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import javax.swing.JTree; +import javax.swing.tree.TreePath; + +import org.fudaa.ctulu.gis.GISLib; +import org.fudaa.ctulu.gis.GISPrecision; +import org.fudaa.ctulu.gis.GISZoneCollectionPoint; +import org.fudaa.ebli.calque.BGroupeCalque; +import org.fudaa.ebli.calque.CalqueGISTreeModel; +import org.fudaa.ebli.calque.ZCalqueMultiPoint; +import org.fudaa.ebli.calque.ZCalquePoint; +import org.fudaa.ebli.calque.ZEbliCalquesPanel; +import org.fudaa.ebli.calque.CalqueGISTreeModel.LayerNode; +import org.fudaa.ebli.geometrie.GrPoint; +import org.fudaa.fudaa.tr.TrPostImplementation; +import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardCourbeTemporelle.ModelListePoints; +import org.jdesktop.swingx.treetable.MutableTreeTableNode; + + + +/** + * Construit un composant arbre g\xE9n\xE9rique qui permet de r\xE9cup\xE9rer les points des calques d'une vue 2d. + * Utiliser surtout pour l'assistant de cr\xE9ation d'\xE9volutions temporelles. + * @author Adrien Hadoux + * + */ +public abstract class TrEvolutionBuilderFromTree { + + + + public static class PostEvolutionTemporelles extends TrEvolutionBuilderFromTree{ + /** + * le modele du tableau a mettre a jour + */ + ModelListePoints modeletableau_; + /** + * la liste des points. Peut etre des points reels mais aussi interpol\xE9s + */ + @SuppressWarnings("unchecked") + List listePoints_; + + + public PostEvolutionTemporelles(TrPostVisuPanel panel, ModelListePoints modeletableau, List liste){ + super(panel); + modeletableau_= modeletableau; + listePoints_=liste; + + } + + protected void apply(){ + + //-- mise a jour des donn\xE9es du tableau--// + modeletableau_.fireTableDataChanged(); + } + + public boolean ajouterSelection(ZCalqueMultiPoint cq){ + boolean modifierStructure=false; + + TrPostInterpolatePoint newPoint=null; + if(cq==null || cq.modeleDonnees()==null) + return false; + + int nb=cq.modeleDonnees().getNombre(); + + for(int i=0;i<nb;i++){ + GrPoint point=(GrPoint) cq.modeleDonnees().getObject(i); + if(point!=null){ + final int idxElt = TrIsoLayerDefault.sondeSelection(point, panel_.getIsoLayer().getIsoModel()); + if (idxElt > -1){ + newPoint= new TrPostInterpolatePoint(idxElt, point.x_, point.y_, new GISPrecision()); + modifierStructure=true; + listePoints_.add(newPoint); + } + } + } + return modifierStructure; + + } + + + public boolean ajouterSelection(ZCalquePoint cq){ + boolean modifierStructure=false; + TrPostInterpolatePoint newPoint=null; + if(cq==null || cq.modeleDonnees()==null) + return false; + + int nb=cq.modeleDonnees().getNombre(); + + for(int i=0;i<nb;i++){ + GrPoint point=cq.getPoint(i); + if(point!=null){ + final int idxElt = TrIsoLayerDefault.sondeSelection(point, panel_.getIsoLayer().getIsoModel()); + if (idxElt > -1){ + newPoint= new TrPostInterpolatePoint(idxElt, point.x_, point.y_, new GISPrecision()); + modifierStructure=true; + if(canAdd(newPoint)) + listePoints_.add(newPoint); + } + } + } + return modifierStructure; + } + + public boolean ajouterSelection(ZCalquePoint cq,int i){ + boolean modifierStructure=false; + TrPostInterpolatePoint newPoint=null; + if(cq==null || cq.modeleDonnees()==null) + return false; + GrPoint point=cq.getPoint(i); + if(point!=null){ + final int idxElt = TrIsoLayerDefault.sondeSelection(point, panel_.getIsoLayer().getIsoModel()); + if (idxElt > -1){ + newPoint= new TrPostInterpolatePoint(idxElt, point.x_, point.y_, new GISPrecision()); + modifierStructure=true; + if(canAdd(newPoint)) + listePoints_.add(newPoint); + } + } + + return modifierStructure; + } + + + private boolean canAdd(TrPostInterpolatePoint pt){ + for(Object ob:listePoints_){ + if(ob instanceof TrPostInterpolatePoint){ + TrPostInterpolatePoint tr=(TrPostInterpolatePoint) ob; + if(tr.equals(pt)) + return false; + } + } + return true; + + } + } + + /** + * Liste des points selectionn\xE9s. + */ + protected GISZoneCollectionPoint pointsSelectionnees_; + + final TrPostVisuPanel panel_; + + protected TrPostImplementation impl_; + + /** + * l'arbre des donn\xE9es representant le calque + */ + public JTree tree_; + + + /** + * le linetreemodel aui filtre uniquement les type d'objets g\xE9om\xE9triaues recherch\xE9s. + */ + final CalqueGISTreeModel lineTreeModel_; + + public TrEvolutionBuilderFromTree(TrPostVisuPanel panel) { + this(panel,null); + } + + public TrEvolutionBuilderFromTree(TrPostVisuPanel panel, TrPostImplementation impl) { + + this.panel_ = panel; + this.impl_ = impl; + pointsSelectionnees_=null; + lineTreeModel_ = new CalqueGISTreeModel(null, panel.getDonneesCalque()); + lineTreeModel_.setMask(GISLib.MASK_POINT); + } + + public GISZoneCollectionPoint getSelection(){ + + if(tree_==null) + return null; + + return null; + } + + public JTree buildTree() { + if(tree_==null){ + tree_=lineTreeModel_.createView(false,false); + //-- gestion double click pour r\xE9cup\xE9rer l'information + tree_.addMouseListener(new MouseAdapter(){ + + + public void mouseClicked(MouseEvent e) { + if(e.getClickCount()<2) + return; + final TreePath clickedElement = tree_.getPathForLocation(e.getX(), e.getY()); + LayerNode treeNode = null; + if (clickedElement != null && clickedElement.getLastPathComponent() instanceof LayerNode) + treeNode=(LayerNode) clickedElement.getLastPathComponent(); + + if(treeNode==null)return; + boolean apply=false; + if(treeNode.getUserObject() instanceof ZCalquePoint && treeNode.isLeaf()) + + apply=ajouterSelection((ZCalquePoint) treeNode.getUserObject(),treeNode.getIdxGeom()); + else + if(treeNode.getUserObject() instanceof ZCalquePoint ) + apply=ajouterSelection((ZCalquePoint) treeNode.getUserObject()); + else + if(treeNode.getUserObject() instanceof ZCalqueMultiPoint) + apply= ajouterSelection((ZCalqueMultiPoint) treeNode.getUserObject()); + else if( treeNode.getUserObject() instanceof BGroupeCalque){ + + if(treeNode.getChildCount()>0 && treeNode.getChildAt(0) instanceof LayerNode){ + + LayerNode treeNodeFils =(LayerNode) treeNode.getChildAt(0); + if(treeNodeFils.getChildCount()>0 && treeNodeFils.getChildAt(0)instanceof LayerNode && !treeNodeFils.isLeaf()) + treeNodeFils=(LayerNode) treeNodeFils.getChildAt(0); + if(treeNodeFils.getUserObject() instanceof ZCalquePoint){ + //-- on recupere le calque global et on l'ajoute direct --// + ZCalquePoint zcq=(ZCalquePoint) treeNodeFils.getUserObject() ; + if(zcq!=null) + apply=ajouterSelection(zcq); + } + + } + + + + } + //-- on fait appel a pply qui met a jour les composants voulues --// + if(apply) + apply(); + } + }); + } + return tree_; + } + + /** + * est appel\xE9e lors du double clic sur le tree. + * @param objectSelection + * @return + */ + public abstract boolean ajouterSelection(ZCalqueMultiPoint cq); + + + + public abstract boolean ajouterSelection(ZCalquePoint cq); + + public abstract boolean ajouterSelection(ZCalquePoint cq,int indice); + + /** + * applique les modifications (listener a appeler ou autre)... + */ + protected abstract void apply(); + +} Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java 2009-02-16 09:52:22 UTC (rev 4475) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/dialogSpec/TrPostWizardCourbeTemporelle.java 2009-02-16 17:11:11 UTC (rev 4476) @@ -27,6 +27,7 @@ import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; +import javax.swing.JSplitPane; import javax.swing.JTextField; import javax.swing.table.AbstractTableModel; @@ -58,6 +59,7 @@ import org.fudaa.fudaa.sig.layer.FSigLayerGroup; import org.fudaa.fudaa.tr.common.TrLib; import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.TrEvolutionBuilderFromTree; import org.fudaa.fudaa.tr.post.TrIsoLayerDefault; import org.fudaa.fudaa.tr.post.TrPostCourbeBuilder; import org.fudaa.fudaa.tr.post.TrPostCourbeTreeModel; @@ -72,6 +74,7 @@ import com.memoire.bu.BuCharValidator; import com.memoire.bu.BuCheckBox; import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuPanel; import com.memoire.bu.BuScrollPane; import com.memoire.bu.BuStringValidator; import com.memoire.bu.BuTextField; @@ -151,6 +154,17 @@ return true; } + + public void fireTableStructureChanged() { + + super.fireTableStructureChanged(); + + if(indicateurPoints_!=null) + indicateurPoints_.setText("Nb points: " + listePoints_.size()); + } + + + // @Override // public void setValueAt(final Object _value, final int _rowIndex, final int _columnIndex) { // if (_columnIndex == 0 || _columnIndex == 3) return; @@ -307,6 +321,9 @@ BuTextField nomCalque_=new BuTextField(10); + TrEvolutionBuilderFromTree builderPointsCalque_; + + /** * Construit le panel qui s occupe de la gestion des points * @@ -314,6 +331,9 @@ */ public JComponent constructSlectionPoint() { // -- le table des points selectionnes --// + final JSplitPane splitpanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT); + + final JPanel content = new JPanel(new BorderLayout()); final ModelListePoints model = new ModelListePoints(); final JXTable tableau = new JXTable(model) { @@ -380,7 +400,7 @@ } model.fireTableDataChanged(); indicateurPoints_.setText("Nb points: " + listePoints_.size()); - if (listePoints_.size() == 0) pointsSaisis = false; + // if (listePoints_.size() == 0) pointsSaisis = false; } } }); @@ -389,7 +409,25 @@ indicateurPoints_.setText("Nb points: " + listePoints_.size()); control.add(indicateurPoints_); content.add(control, BorderLayout.SOUTH); - return content; + + content.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Points s\xE9lectionn\xE9s"))); + + //-- ajout du panel de selection des zcqlauePoints de la vue 2d --// + + + builderPointsCalque_=new TrEvolutionBuilderFromTree.PostEvolutionTemporelles(this.calque_,model,listePoints_); + + splitpanel.setTopComponent(content); + + BuPanel conteneurArbre=new BuPanel(new BorderLayout()); + conteneurArbre.setBorder(BorderFactory.createTitledBorder(TrResource.getS("Points de la vue 2d"))); + conteneurArbre.add(new BuScrollPane(builderPointsCalque_.buildTree())); + + conteneurArbre.add(new JLabel(TrResource.getS("<html><body>Pour ajouter les points, double cliquez dessus. Pour ajouter directement tous les points d'un calque,<br /> double-cliquez sur le calque lui m\xEAme</body></html>")),BorderLayout.NORTH); + + splitpanel.setBottomComponent(conteneurArbre); + splitpanel.setDividerLocation(150); + return splitpanel; } /** @@ -691,8 +729,7 @@ public JComponent getStepComponent() { switch (current_) { case 0: { - if (listePoints_.size() != 0) pointsSaisis = true; - else pointsSaisis = false; + if (panelSelectionPoints == null) panelSelectionPoints = constructSlectionPoint(); return panelSelectionPoints; } @@ -716,8 +753,12 @@ return 3; } - private boolean pointsSaisis = false; + private boolean pointsSaisis(){ + return listePoints_.size()>0; + } + + /** * MEthode utilisee pour disabler ou non les boutons suivants */ @@ -725,7 +766,7 @@ public int getStepDisabledButtons() { int r = super.getStepDisabledButtons(); if (current_ == 1) { - if (!pointsSaisis) r |= BuButtonPanel.SUIVANT; + if (!pointsSaisis()) r |= BuButtonPanel.SUIVANT; } else if (current_ == 2) { if ((listeGraphesChoisis_ == null || listeGraphesChoisis_.size() == 0) && !checkboxNewGraphe_.isSelected()) r |= BuButtonPanel.TERMINER; // -- pour empecher d avancer, voir ci dessous @@ -888,7 +929,7 @@ } indicateurPoints_.setText("Nb points: " + listePoints_.size()); - if (listePoints_.size() > 0) pointsSaisis = true; + // if (listePoints_.size() > 0) pointsSaisis = true; dialog.dispose(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-02-16 09:52:25
|
Revision: 4475 http://fudaa.svn.sourceforge.net/fudaa/?rev=4475&view=rev Author: bmarchan Date: 2009-02-16 09:52:22 +0000 (Mon, 16 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java 2009-02-16 09:23:45 UTC (rev 4474) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java 2009-02-16 09:52:22 UTC (rev 4475) @@ -188,7 +188,11 @@ nbProfilNotKeep++; } } - analyze_.addWarn(DodicoLib.getS(nbProfilNotKeep+" profils sur "+(indexProfils.size()+nbProfilNotKeep)+" non \xE9crit car non conformes."), -1); + if (nbProfilNotKeep>0) + analyze_.addWarn(DodicoLib.getS("{0} profils sur {1} n'ont pas \xE9t\xE9 export\xE9s car ils ne sont pas conformes",""+nbProfilNotKeep,""+(indexProfils.size()+nbProfilNotKeep)), -1); + else + analyze_.addInfo(DodicoLib.getS("{0} profils ont \xE9t\xE9 export\xE9s",""+(indexProfils.size()+nbProfilNotKeep))); + // G\xE9n\xE9ration des MascaretProfilAbstractRepresentations \\ profils_=new MascaretProfilAbstractRepresentation[profils.size()]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-02-16 09:23:51
|
Revision: 4474 http://fudaa.svn.sourceforge.net/fudaa/?rev=4474&view=rev Author: bmarchan Date: 2009-02-16 09:23:45 +0000 (Mon, 16 Feb 2009) Log Message: ----------- Respet des points Bathy/Topo Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java 2009-02-16 08:27:27 UTC (rev 4473) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java 2009-02-16 09:23:45 UTC (rev 4474) @@ -284,13 +284,13 @@ // Bathy Topo ou Stockage if(sepsT.length==4){ int j; - for(j=0;j<=sepsT[0];j++) + for(j=0;j<sepsT[0];j++) profilAbs.bathyOuTopoOuStockage.add('S'); - for(;j<=sepsT[1];j++) + for(;j<sepsT[1];j++) profilAbs.bathyOuTopoOuStockage.add('T'); - for(;j<sepsT[2];j++) + for(;j<=sepsT[2];j++) profilAbs.bathyOuTopoOuStockage.add('B'); - for(;j<sepsT[3];j++) + for(;j<=sepsT[3];j++) profilAbs.bathyOuTopoOuStockage.add('T'); for(;j<coordSeq.size();j++) profilAbs.bathyOuTopoOuStockage.add('S'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-02-16 08:27:33
|
Revision: 4473 http://fudaa.svn.sourceforge.net/fudaa/?rev=4473&view=rev Author: hadouxad Date: 2009-02-16 08:27:27 +0000 (Mon, 16 Feb 2009) Log Message: ----------- test ps Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java 2009-02-15 23:05:09 UTC (rev 4472) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java 2009-02-16 08:27:27 UTC (rev 4473) @@ -1,19 +1,43 @@ package org.fudaa.ctulu.image; +import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Collection; +import javax.print.Doc; +import javax.print.DocFlavor; +import javax.print.DocPrintJob; +import javax.print.PrintException; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.SimpleDoc; +import javax.print.StreamPrintService; +import javax.print.StreamPrintServiceFactory; +import javax.print.attribute.HashDocAttributeSet; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.standard.Copies; +import javax.print.attribute.standard.MediaSize; +import javax.print.attribute.standard.Sides; import javax.swing.JTable; import org.fudaa.ctulu.CtuluResource; +import org.jdesktop.swingx.painter.ImagePainter; +import sun.print.PageableDoc; + import com.db4o.inside.Exceptions4; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; @@ -26,10 +50,8 @@ import com.lowagie.text.pdf.PdfPTable; import com.lowagie.text.pdf.PdfTemplate; import com.lowagie.text.pdf.PdfWriter; -import com.rie.rieps.engine.Job; -import com.rie.rieps.engine.Page; -import com.rie.rieps.engine.image.SmallGrayImage; + /** * Classe qui g\xE8re l'exportation pdf et ps. * utilise la librairie iText. @@ -87,52 +109,59 @@ } - +public static class PrintableObject implements Printable{ + BufferedImage image_; + public PrintableObject(BufferedImage img){ + image_=img; + } + public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) + throws PrinterException { + graphics.drawImage(image_,0,0,null); + return 0; + } +} + /** *Un lecteur ps *@author Adrien Hadoux */ public static void writePostScript(final RenderedImage _image, final File _targetFile, final String _format) throws Exception{ - //-- creaton de l'image ps--// - SmallGrayImage bwi = new SmallGrayImage(SmallGrayImage.CONVERT_MODE_AVERAGE); - bwi.load((BufferedImage) _image); - OutputStream os = new FileOutputStream(_targetFile); + +// PrintableObject objectToPrint=new PrintableObject((BufferedImage) _image); +// +// +// PrinterJob job = PrinterJob.getPrinterJob(); +// job.setPrintable(objectToPrint); +// +// String psMimeType = "application/postscript"; +// FileOutputStream outstream; +// StreamPrintService psPrinter=null; +// StreamPrintServiceFactory []spsFactories = +// PrinterJob.lookupStreamPrintServices(psMimeType); +// if (spsFactories.length > 0) { +// try { +// outstream = new FileOutputStream(_targetFile); +// psPrinter = spsFactories[0].getPrintService(outstream); +// // psPrinter can now be set as the service on a PrinterJob +// } catch (FileNotFoundException e) { +// throw e; +// } +// } +// +// +// +// job.setPrintService(psPrinter); // if app wants to specify this printer. +// PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); +// aset.add(new Copies(1)); +// +// +// +// job.print(aset); + } - Job job = Job.createPSTopLeftOriginJob(os, 595, 842); + + - // Set usable postscript fonts of the device - job.setAvailableDeviceFont(new String[]{"Times-Roman", "Helvetica", "Courier", "Times-Italic", "Times-Bold", "Helvetica-Bold"}); - - // Show the dialog box the link unkwown awt font to device postscript font - job.askForUnmappedAWTFont(true); - - // output the awt/postscript font links. - // The output is well formatted to be automatically loaded by the RiePS library - // for future jobs - job.echoFontMapping(true); - - // Open the job - job.open(); - - - // Create a 2 pages document into the job - com.rie.rieps.engine.Document doc = job.createDocument(1); - doc.open(); - - // create a page - Page p = doc.createPage(); - // insert the same page with a picture added - p.drawImage(500, 200, bwi, 100, 100); - doc.showPage(p); - - // close the document and the job - doc.close(); - job.close(); - - - } - - /** * Test si le format est un format pdf ou ps * @param format This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2009-02-15 23:05:14
|
Revision: 4472 http://fudaa.svn.sourceforge.net/fudaa/?rev=4472&view=rev Author: deniger Date: 2009-02-15 23:05:09 +0000 (Sun, 15 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/DateIterator.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIterator.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/TickIterator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostVisuPanelPersistManager.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorGraduationsFixe.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorPasFixe.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/DateIterator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/DateIterator.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/DateIterator.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -43,11 +43,13 @@ import java.util.Locale; import java.util.TimeZone; +import org.fudaa.ctulu.CtuluLib; + /** * It\xE9rateur balayant les barres et \xE9tiquettes de graduation d'un axe du temps. Cet it\xE9rateur retourne les positions des * graduations \xE0 partir de la date la plus ancienne jusqu'\xE0 la date la plus r\xE9cente. Il choisit les intervalles de * graduation en supposant qu'on utilise un calendrier gr\xE9gorien. - * + * * @version $Id: DateIterator.java,v 1.1 2007-01-17 10:45:26 deniger Exp $ * @author Martin Desruisseaux */ @@ -83,8 +85,8 @@ /** * Liste des intervales souhait\xE9s pour la graduation. Les \xE9l\xE9ments de cette table doivent obligatoirement appara\xEEtre * en ordre croissant. Voici un exemple d'interpr\xE9tation: la pr\xE9sence de <code>5*MIN</code> suivit de - * <code>10*MIN</code> implique que si le pas estim\xE9 se trouve entre 5 et 10 minutes, ce sera le pas de 10 minutes - * qui sera s\xE9lectionn\xE9. + * <code>10*MIN</code> implique que si le pas estim\xE9 se trouve entre 5 et 10 minutes, ce sera le pas de 10 minutes qui + * sera s\xE9lectionn\xE9. */ private static final long[] INTERVAL = { SEC, 2 * SEC, 5 * SEC, 10 * SEC, 15 * SEC, 20 * SEC, 30 * SEC, MIN, 2 * MIN, 5 * MIN, 10 * MIN, 15 * MIN, 20 * MIN, 30 * MIN, HRE, 2 * HRE, 3 * HRE, 4 * HRE, 6 * HRE, 8 * HRE, 12 * HRE, DAY, @@ -97,9 +99,16 @@ * puis traduira cet intervalle en champ du calendrier gr\xE9gorien en lisant les \xE9l\xE9ments correspondants de ce tableau * {@link #ROLL}. */ - private static final byte[] ROLL = { 1, (byte) Calendar.SECOND, 25, (byte) Calendar.MILLISECOND, // x10 + private static final byte[] ROLL = { + 1, + (byte) Calendar.SECOND, + 25, + (byte) Calendar.MILLISECOND, // x10 // millis - 2, (byte) Calendar.SECOND, 50, (byte) Calendar.MILLISECOND, // x10 millis + 2, + (byte) Calendar.SECOND, + 50, + (byte) Calendar.MILLISECOND, // x10 millis 5, (byte) Calendar.SECOND, 1, (byte) Calendar.SECOND, 10, (byte) Calendar.SECOND, 2, (byte) Calendar.SECOND, 15, (byte) Calendar.SECOND, 5, (byte) Calendar.SECOND, 20, (byte) Calendar.SECOND, 5, (byte) Calendar.SECOND, 30, (byte) Calendar.SECOND, 5, (byte) Calendar.SECOND, 1, (byte) Calendar.MINUTE, 10, (byte) Calendar.SECOND, 2, @@ -122,8 +131,8 @@ (byte) Calendar.YEAR, 1, (byte) Calendar.YEAR, 5, (byte) Calendar.YEAR, 1, (byte) Calendar.YEAR }; /** - * Nombre de colonne dans le tableau {@link ROLL}. Le tableau {@link ROLL}doit \xEAtre interpr\xE9t\xE9 comme une matrice de - * 4 colonnes et d'un nombre ind\xE9termin\xE9 de lignes. + * Nombre de colonne dans le tableau {@link ROLL}. Le tableau {@link ROLL}doit \xEAtre interpr\xE9t\xE9 comme une matrice de 4 + * colonnes et d'un nombre ind\xE9termin\xE9 de lignes. */ private static final int ROLL_WIDTH = 4; @@ -247,21 +256,21 @@ /** * Code du format utilis\xE9 pour construire le champ de date de {@link #format_}. Les codes valides sont notamment - * {@link DateFormat#SHORT},{@link DateFormat#MEDIUM}ou {@link DateFormat#LONG}. La valeur -1 indique que le - * format ne contient pas de champ de date, seulement un champ des heures. + * {@link DateFormat#SHORT},{@link DateFormat#MEDIUM}ou {@link DateFormat#LONG}. La valeur -1 indique que le format ne + * contient pas de champ de date, seulement un champ des heures. */ private transient int dateFormat_ = -1; /** * Code du format utilis\xE9 pour construire le champ des heures de {@link #format_}. Les codes valides sont notamment - * {@link DateFormat#SHORT},{@link DateFormat#MEDIUM}ou {@link DateFormat#LONG}. La valeur -1 indique que le format - * ne contient pas de champ des heures, seulement un champ de date. + * {@link DateFormat#SHORT},{@link DateFormat#MEDIUM}ou {@link DateFormat#LONG}. La valeur -1 indique que le format ne + * contient pas de champ des heures, seulement un champ de date. */ private transient int timeFormat_ = -1; /** - * Indique si {@link #format_}est valide. Le format peut devenir invalide si {@link #init}a \xE9t\xE9 appel\xE9e. Dans ce - * cas, il peut falloir changer le nombre de chiffres apr\xE8s la virgule qu'il \xE9crit. + * Indique si {@link #format_}est valide. Le format peut devenir invalide si {@link #init}a \xE9t\xE9 appel\xE9e. Dans ce cas, + * il peut falloir changer le nombre de chiffres apr\xE8s la virgule qu'il \xE9crit. */ private transient boolean formatValid_; @@ -284,15 +293,13 @@ /** * Construit un it\xE9rateur pour la graduation d'un axe du temps. La m\xE9thode {@link #init(double, double, int)}<u>doit * </u> \xEAtre appel\xE9e avant que l'it\xE9rateur ne soit utilisable. - * + * * @param _timezone Fuseau horaire des dates. * @param _locale Conventions \xE0 utiliser pour le formatage des dates. */ public DateIterator(final TimeZone _timezone, final Locale _locale) { // assert INTERVAL.length*ROLL_WIDTH == ROLL.length; - if (INTERVAL.length * ROLL_WIDTH != ROLL.length) { - throw new IllegalArgumentException(); - } + if (INTERVAL.length * ROLL_WIDTH != ROLL.length) { throw new IllegalArgumentException(); } calendar_ = Calendar.getInstance(_timezone, _locale); this.locale_ = _locale; } @@ -349,9 +356,20 @@ init((long) (_min * 1000), (long) (_max * 1000), _nbTick <= 2 ? 2 : (_nbTick - 1), 1); } + public void initExact(final double _min, final double _max, final int _nbTick, final int nbSousTick) { + init((long) (_min * 1000), (long) (_max * 1000), _nbTick <= 2 ? 2 : (_nbTick - 1), 1); + } + + public void initExactFromDist(double _min, double _max, double _increment, int _nbSousIteration) { + if (CtuluLib.isZero(_increment)) { + init(_min, _max, 1); + } else init(_min, _max, Math.abs(_max - _min) / Math.abs(_increment)); + + } + /** * Initialise l'it\xE9rateur. - * + * * @param _minimum Date minimale de la premi\xE8re graduation. * @param _maximum Date limite des graduations. La derni\xE8re graduation ne sera pas n\xE9cessairement \xE0 cette date. * @param _visualLength Longueur visuelle de l'axe sur laquelle tracer la graduation. Cette longueur doit \xEAtre @@ -452,13 +470,13 @@ value_ = minimum_; date_.setTime(value_); calendar_.setTime(date_); - // Arrondie la date de d\xE9part. Note: ce calcul exige que - // tous les champs commencent \xE0 0 plut\xF4t que 1, y compris - // les mois et le jour du mois. - final int offset = calendar_.getActualMinimum(tickField_); - int toRound = calendar_.get(tickField_) - offset; - toRound = (toRound / tickAdd_) * tickAdd_; - calendar_.set(tickField_, toRound + offset); + // Arrondie la date de d\xE9part. Note: ce calcul exige que + // tous les champs commencent \xE0 0 plut\xF4t que 1, y compris + // les mois et le jour du mois. + final int offset = calendar_.getActualMinimum(tickField_); + int toRound = calendar_.get(tickField_) - offset; + toRound = (toRound / tickAdd_) * tickAdd_; + calendar_.set(tickField_, toRound + offset); truncate(calendar_, tickField_); nextTick_ = calendar_.getTime().getTime(); nextSubTick_ = nextTick_; @@ -486,22 +504,20 @@ this.isMajorTick0_ = this.isMajorTick_; // assert ; - if (calendar_.getTime().getTime() != nextSubTick_) { - throw new IllegalArgumentException(); - } + if (calendar_.getTime().getTime() != nextSubTick_) { throw new IllegalArgumentException(); } } /** * Met \xE0 0 tous les champs du calendrier inf\xE9rieur au champ <code>field</code> sp\xE9cifi\xE9. Note: si le calendrier - * sp\xE9cifi\xE9 est {@link #calendar_}, il est de la responsabilit\xE9 de l'appelant de restituer {@link #calendar_}dans - * son \xE9tat correct apr\xE8s l'appel de cette m\xE9thode. + * sp\xE9cifi\xE9 est {@link #calendar_}, il est de la responsabilit\xE9 de l'appelant de restituer {@link #calendar_}dans son + * \xE9tat correct apr\xE8s l'appel de cette m\xE9thode. */ - private static void truncate(final Calendar _calendar,final int _field) { - int field=_field; + private static void truncate(final Calendar _calendar, final int _field) { + int field = _field; for (int i = 0; i < FIELD.length; i++) { if (FIELD[i] == field) { _calendar.get(field); // Force la mise \xE0 jour des champs. - int k=i; + int k = i; while (++k < FIELD.length) { field = FIELD[k]; _calendar.set(field, _calendar.getActualMinimum(field)); @@ -521,9 +537,9 @@ /** * Indique si la graduation courante est une graduation majeure. - * - * @return <code>true</code> si la graduation courante est une graduation majeure, ou <code>false</code> si elle - * est une graduation mineure. + * + * @return <code>true</code> si la graduation courante est une graduation majeure, ou <code>false</code> si elle est + * une graduation mineure. */ public boolean isMajorTick() { return isMajorTick_; @@ -607,9 +623,7 @@ */ public void next() { // assert calendar.getTime().getTime() == nextSubTick; - if (calendar_.getTime().getTime() != nextSubTick_) { - throw new IllegalArgumentException(); - } + if (calendar_.getTime().getTime() != nextSubTick_) { throw new IllegalArgumentException(); } if (nextSubTick_ < nextTick_) { isMajorTick_ = false; value_ = nextSubTick_; @@ -617,12 +631,12 @@ * IMPORTANT: On suppose ici que 'calendar' a d\xE9j\xE0 la date 'nextSubTick'. Si ce n'\xE9tait pas le cas, il faudrait * ajouter les lignes suivantes: */ -// if (false) { -// date_.setTime(value_); -// calendar_.setTime(date_); -// // 'setTime' oblige 'calendar' \xE0 recalculer ses -// // champs, ce qui a un impact sur la performance. -// } + // if (false) { + // date_.setTime(value_); + // calendar_.setTime(date_); + // // 'setTime' oblige 'calendar' \xE0 recalculer ses + // // champs, ce qui a un impact sur la performance. + // } calendar_.add(subTickField_, subTickAdd_); nextSubTick_ = calendar_.getTime().getTime(); // 'calendar' contient maintenant la date 'nextSubTick', @@ -682,13 +696,12 @@ initFormatVar(); } - if (calendar_.getTime().getTime() != nextSubTick_) { - throw new IllegalArgumentException(); - // assert calendar.getTime().getTime() == nextSubTick; + if (calendar_.getTime().getTime() != nextSubTick_) { throw new IllegalArgumentException(); + // assert calendar.getTime().getTime() == nextSubTick; } } - private void initFormatVar(){ + private void initFormatVar() { format_ = null; formatValid_ = false; // Pour \xEAtre en accord avec la sp\xE9cification @@ -712,9 +725,8 @@ calendar_.setTimeZone(_timezone); initFormatVar(); } - if (calendar_.getTime().getTime() != nextSubTick_) { - throw new IllegalArgumentException(); - // assert calendar.getTime().getTime() == nextSubTick; + if (calendar_.getTime().getTime() != nextSubTick_) { throw new IllegalArgumentException(); + // assert calendar.getTime().getTime() == nextSubTick; } } @@ -723,9 +735,7 @@ */ private static String getFieldName(final int _field) { for (int i = 0; i < FIELD.length; i++) { - if (FIELD[i] == _field) { - return FIELD_NAME[i]; - } + if (FIELD[i] == _field) { return FIELD_NAME[i]; } } return String.valueOf(_field); } @@ -734,39 +744,38 @@ * Returns a string representation of this iterator. Used for debugging purpose only. */ public String toString() { - // Note: in this particular case, using PrintWriter with 'println' generates - // less bytecodes than chaining StringBuffer.append(...) calls. - final StringWriter buf = new StringWriter(); - final PrintWriter out = new PrintWriter(buf); - final DateFormat formatTmp = DateFormat.getDateTimeInstance(); - formatTmp.setTimeZone(calendar_.getTimeZone()); - out.print("Minimum = "); - out.println(formatTmp.format(new Date(minimum_))); - out.print("Maximum = "); - out.println(formatTmp.format(new Date(maximum_))); - out.print("Increment = "); - out.print(increment_ / (24 * 3600000f)); - out.println(" days"); - out.print("Tick inc. = "); - out.print(tickAdd_); - out.print(' '); - out.println(getFieldName(tickField_)); - out.print("SubTick inc. = "); - out.print(subTickAdd_); - out.print(' '); - out.println(getFieldName(subTickField_)); - out.print("Next tick = "); - out.println(formatTmp.format(new Date(nextTick_))); - out.print("Next subtick = "); - out.println(formatTmp.format(new Date(nextSubTick_))); - out.flush(); - return buf.toString(); + // Note: in this particular case, using PrintWriter with 'println' generates + // less bytecodes than chaining StringBuffer.append(...) calls. + final StringWriter buf = new StringWriter(); + final PrintWriter out = new PrintWriter(buf); + final DateFormat formatTmp = DateFormat.getDateTimeInstance(); + formatTmp.setTimeZone(calendar_.getTimeZone()); + out.print("Minimum = "); + out.println(formatTmp.format(new Date(minimum_))); + out.print("Maximum = "); + out.println(formatTmp.format(new Date(maximum_))); + out.print("Increment = "); + out.print(increment_ / (24 * 3600000f)); + out.println(" days"); + out.print("Tick inc. = "); + out.print(tickAdd_); + out.print(' '); + out.println(getFieldName(tickField_)); + out.print("SubTick inc. = "); + out.print(subTickAdd_); + out.print(' '); + out.println(getFieldName(subTickField_)); + out.print("Next tick = "); + out.println(formatTmp.format(new Date(nextTick_))); + out.print("Next subtick = "); + out.println(formatTmp.format(new Date(nextSubTick_))); + out.flush(); + return buf.toString(); } + public void init(double _min, double _max, double pasDeTemps) { + init(_min, _max, (int) pasDeTemps); -public void init(double _min, double _max, double pasDeTemps) { -init(_min, _max, (int)pasDeTemps); + } -} - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIterator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIterator.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIterator.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -40,14 +40,29 @@ import org.geotools.resources.XMath; /** - * It\xE9rateur balayant les barres et \xE9tiquettes de graduation d'un axe. Cet it\xE9rateur retourne les - * positions des graduations \xE0 partir de la valeur minimale jusqu'\xE0 la valeur maximale. + * It\xE9rateur balayant les barres et \xE9tiquettes de graduation d'un axe. Cet it\xE9rateur retourne les positions des + * graduations \xE0 partir de la valeur minimale jusqu'\xE0 la valeur maximale. + * * @version $Id: NumberIterator.java,v 1.1 2007-01-17 10:45:26 deniger Exp $ * @author Martin Desruisseaux */ public class NumberIterator implements TickIterator { /** + * @return the maxFractionDigits + */ + public int getMaxFractionDigits() { + return maxFractionDigits; + } + + /** + * @param _maxFractionDigits the maxFractionDigits to set + */ + public void setMaxFractionDigits(int _maxFractionDigits) { + maxFractionDigits = _maxFractionDigits; + } + + /** * Petite quantit\xE9 utilis\xE9e pour \xE9viter les erreurs d'arrondissements dans les comparaisons. */ private static final double EPS = 1E-10; @@ -57,9 +72,8 @@ private static final int MAX_ITERATION = 200; /** - * Indique si {@link #format_}est valide. Le format peut devenir invalide si {@link #init}a \xE9t\xE9 - * appel\xE9e. Dans ce cas, il peut falloir changer le nombre de chiffres apr\xE8s la virgule qu'il - * \xE9crit. + * Indique si {@link #format_}est valide. Le format peut devenir invalide si {@link #init}a \xE9t\xE9 appel\xE9e. Dans ce cas, + * il peut falloir changer le nombre de chiffres apr\xE8s la virgule qu'il \xE9crit. */ private transient boolean formatValid_; @@ -71,8 +85,8 @@ int iterationDone_; /** - * Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement cette valeur. - * Cette valeur est fix\xE9e par {@link #init}. + * Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement cette valeur. Cette valeur est + * fix\xE9e par {@link #init}. */ private double maximum_; @@ -82,66 +96,65 @@ private double minimum_; /** - * Nombre de sous-divisions dans une graduation principale. Cette valeur est fix\xE9e par - * {@link #init}. + * Nombre de sous-divisions dans une graduation principale. Cette valeur est fix\xE9e par {@link #init}. */ private int subTickCount_; /** - * Index de la graduation secondaire en cours de tra\xE7age. Cette valeur va de 0 inclusivement - * jusqu'\xE0 {@link #subTickCount_}exclusivement. Elle sera modifi\xE9e \xE0 chaque appel \xE0 {@link #next}. + * Index de la graduation secondaire en cours de tra\xE7age. Cette valeur va de 0 inclusivement jusqu'\xE0 + * {@link #subTickCount_}exclusivement. Elle sera modifi\xE9e \xE0 chaque appel \xE0 {@link #next}. */ private int subTickIndex_; /** - * Index de la premi\xE8re sous-graduation dans la premi\xE8re graduation principale. Cette valeur est - * fix\xE9e par {@link #init}. + * Index de la premi\xE8re sous-graduation dans la premi\xE8re graduation principale. Cette valeur est fix\xE9e par + * {@link #init}. */ private int subTickStart_; /** - * Index de la graduation principale en cours de tra\xE7age. Cette valeur commence \xE0 0 et sera - * modifi\xE9e \xE0 chaque appel \xE0 {@link #next}. + * Index de la graduation principale en cours de tra\xE7age. Cette valeur commence \xE0 0 et sera modifi\xE9e \xE0 chaque appel \xE0 + * {@link #next}. */ private int tickIndex_; /** - * Valeur de la graduation principale ou secondaire actuelle. Cette valeur sera modifi\xE9e \xE0 chaque - * appel \xE0 {@link #next}. + * Valeur de la graduation principale ou secondaire actuelle. Cette valeur sera modifi\xE9e \xE0 chaque appel \xE0 + * {@link #next}. */ private double value_; /** - * Longueur de l'axe (en points). Cette information est conserv\xE9e afin d'\xE9viter de refaire toute - * la proc\xE9dure {@link #init}si les param\xE8tres n'ont pas chang\xE9s. + * Longueur de l'axe (en points). Cette information est conserv\xE9e afin d'\xE9viter de refaire toute la proc\xE9dure + * {@link #init}si les param\xE8tres n'ont pas chang\xE9s. */ private float visualLength_; /** - * Espace \xE0 laisser (en points) entre les graduations principales. Cette information est conserv\xE9e - * afin d'\xE9viter de refaire toute la proc\xE9dure {@link #init}si les param\xE8tres n'ont pas chang\xE9s. + * Espace \xE0 laisser (en points) entre les graduations principales. Cette information est conserv\xE9e afin d'\xE9viter de + * refaire toute la proc\xE9dure {@link #init}si les param\xE8tres n'ont pas chang\xE9s. */ private float visualTickSpacing_; /** - * Format \xE0 utiliser pour \xE9crire les \xE9tiquettes de graduation. Ce format ne sera construit que la - * premi\xE8re fois o\xF9 {@link #currentLabel}sera appel\xE9e. + * Format \xE0 utiliser pour \xE9crire les \xE9tiquettes de graduation. Ce format ne sera construit que la premi\xE8re fois o\xF9 + * {@link #currentLabel}sera appel\xE9e. */ protected transient NumberFormat format_; NumberFormat subFormat_; /** - * Construit un it\xE9rateur par d\xE9faut. La m\xE9thode {@link #init(double, double, float, float)}<u>doit </u> \xEAtre appel\xE9e avant que - * cet it\xE9rateur ne soit utilisable. + * Construit un it\xE9rateur par d\xE9faut. La m\xE9thode {@link #init(double, double, float, float)}<u>doit </u> \xEAtre appel\xE9e + * avant que cet it\xE9rateur ne soit utilisable. */ public NumberIterator() { - //this.locale = locale; + // this.locale = locale; } public NumberIterator(final NumberIterator _it) { initFrom(_it); - //this.locale = locale; + // this.locale = locale; } protected final void initFrom(final NumberIterator _it) { @@ -163,24 +176,23 @@ } } - protected void buildSubFormat(){ + protected void buildSubFormat() { if (format_ == null) { subFormat_ = null; - } - else if (subFormat_ == null) { + } else if (subFormat_ == null) { subFormat_ = (NumberFormat) format_.clone(); updateSubFormat(); } } - private void updateSubFormat(){ + private void updateSubFormat() { if (subFormat_ != null && format_ != null) { subFormat_.setMaximumFractionDigits(format_.getMaximumFractionDigits() + 1); subFormat_.setMinimumFractionDigits(format_.getMinimumFractionDigits()); } } - protected void buildFormat(final boolean _sci){ + protected void buildFormat(final boolean _sci) { if (format_ == null) { final DecimalFormat decFormat = _sci ? new DecimalFormat("0.###E0") : new DecimalFormat(); @@ -194,18 +206,18 @@ /** * Initialise l'it\xE9rateur. + * * @param _minimum Valeur minimale de la premi\xE8re graduation. - * @param _maximum Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement - * cette valeur. - * @param _visualLength Longueur visuelle de l'axe sur laquelle tracer la graduation. Cette - * longueur doit \xEAtre exprim\xE9e en pixels ou en points. - * @param _visualTickSpacing Espace \xE0 laisser visuellement entre deux marques de graduation. Cet - * espace doit \xEAtre exprim\xE9 en pixels ou en points (1/72 de pouce). + * @param _maximum Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement cette valeur. + * @param _visualLength Longueur visuelle de l'axe sur laquelle tracer la graduation. Cette longueur doit \xEAtre + * exprim\xE9e en pixels ou en points. + * @param _visualTickSpacing Espace \xE0 laisser visuellement entre deux marques de graduation. Cet espace doit \xEAtre + * exprim\xE9 en pixels ou en points (1/72 de pouce). */ - protected void init(final double _minimum,final double _maximum,final float _visualLength, - final float _visualTickSpacing){ + protected void init(final double _minimum, final double _maximum, final float _visualLength, + final float _visualTickSpacing) { if (_minimum == this.minimum_ && _maximum == this.maximum_ && _visualLength == this.visualLength_ - && _visualTickSpacing == this.visualTickSpacing_) { + && _visualTickSpacing == this.visualTickSpacing_) { rewind(); return; } @@ -216,9 +228,8 @@ this.visualLength_ = _visualLength; this.visualTickSpacing_ = _visualTickSpacing; /* - * Estime le pas qui donnera au moins l'espacement sp\xE9cifi\xE9 entre chaque graduation. D\xE9termine - * ensuite si ce pas est de l'ordre des dizaines, centaines ou autre et on ram\xE8nera - * temporairement ce pas \xE0 l'ordre des unit\xE9es. + * Estime le pas qui donnera au moins l'espacement sp\xE9cifi\xE9 entre chaque graduation. D\xE9termine ensuite si ce pas est + * de l'ordre des dizaines, centaines ou autre et on ram\xE8nera temporairement ce pas \xE0 l'ordre des unit\xE9es. */ double incrementTmp = (_maximum - _minimum) * (_visualTickSpacing / _visualLength); final double factor = XMath.pow10((int) Math.floor(XMath.log10(incrementTmp))); @@ -236,38 +247,33 @@ return; } /* - * Le pas se trouve maintenant entre 1 et 10. On l'ajuste maintenant pour lui donner des valeurs - * qui ne sont habituellement pas trop difficiles \xE0 lire. + * Le pas se trouve maintenant entre 1 et 10. On l'ajuste maintenant pour lui donner des valeurs qui ne sont + * habituellement pas trop difficiles \xE0 lire. */ final int subTickCountTmp; if (incrementTmp <= 1.0) { incrementTmp = 1.0; subTickCountTmp = 5; - } - else if (incrementTmp <= 2.0) { + } else if (incrementTmp <= 2.0) { incrementTmp = 2.0; subTickCountTmp = 4; - } - else if (incrementTmp <= 2.5) { + } else if (incrementTmp <= 2.5) { incrementTmp = 2.5; subTickCountTmp = 5; - } - else if (incrementTmp <= 4.0) { + } else if (incrementTmp <= 4.0) { incrementTmp = 4.0; subTickCountTmp = 4; - } - else if (incrementTmp <= 5.0) { + } else if (incrementTmp <= 5.0) { incrementTmp = 5.0; subTickCountTmp = 5; - } - else { + } else { incrementTmp = 10.0; subTickCountTmp = 5; } incrementTmp = incrementTmp * factor; /* - * Arrondie maintenant le minimum sur une des graduations principales. D\xE9termine ensuite combien - * de graduations secondaires il faut sauter sur la premi\xE8re graduation principale. + * Arrondie maintenant le minimum sur une des graduations principales. D\xE9termine ensuite combien de graduations + * secondaires il faut sauter sur la premi\xE8re graduation principale. */ final double tmp = _minimum; double minimumAxe = Math.floor(_minimum / incrementTmp + EPS) * incrementTmp; @@ -288,29 +294,47 @@ iterationDone_ = 0; } - public void init(double _min,double _max, double pasDeTemps){} - - - public final Object clone() throws CloneNotSupportedException{ - final NumberIterator res=(NumberIterator )super.clone(); + public void initExact(double _min, double _max, int _nbIteration, int _nbSousIteration) { + initExactCommon(_min, _max, _nbSousIteration); + increment_ = (maximum_ - minimum_) / Math.max(_nbIteration, 1); + } + + private void initExactCommon(double _min, double _max, int _nbSousIteration) { + minimum_ = Math.min(_min, _max); + maximum_ = Math.max(_min, _max); + subTickCount_ = Math.max(0, _nbSousIteration); + tickIndex_ = 0; + value_ = _min; + this.subTickStart_ = 0; + this.subTickIndex_ = 0; + this.formatValid_ = false; + iterationDone_ = 0; + } + + public void initExactFromDist(double _min, double _max, double _increment, int _nbSousIteration) { + initExactCommon(_min, _max, _nbSousIteration); + increment_ = _increment; + + } + + public final Object clone() throws CloneNotSupportedException { + final NumberIterator res = (NumberIterator) super.clone(); res.initFrom(this); return res; } /** - * Retourne l'\xE9tiquette de la graduation courante. On n'appele g\xE9n\xE9ralement cette m\xE9thode que pour - * les graduations majeures, mais elle peut aussi \xEAtre appel\xE9e pour les graduations mineures. - * Cette m\xE9thode retourne <code>null</code> s'il n'y a pas d'\xE9tiquette pour la graduation - * courante. + * Retourne l'\xE9tiquette de la graduation courante. On n'appele g\xE9n\xE9ralement cette m\xE9thode que pour les graduations + * majeures, mais elle peut aussi \xEAtre appel\xE9e pour les graduations mineures. Cette m\xE9thode retourne <code>null</code> + * s'il n'y a pas d'\xE9tiquette pour la graduation courante. */ - public String currentLabel(){ + public String currentLabel() { if (!formatValid_) { buildFormat(false); /* - * Trouve le nombre de chiffres apr\xE8s la virgule n\xE9cessaires pour repr\xE9senter les \xE9tiquettes - * de la graduation. Impose une limite de six chiffres, limite qui pourrait \xEAtre atteinte - * notamment avec les nombres p\xE9riodiques (par exemple des intervalles de temps exprim\xE9s en - * fractions de jours). + * Trouve le nombre de chiffres apr\xE8s la virgule n\xE9cessaires pour repr\xE9senter les \xE9tiquettes de la graduation. + * Impose une limite de six chiffres, limite qui pourrait \xEAtre atteinte notamment avec les nombres p\xE9riodiques + * (par exemple des intervalles de temps exprim\xE9s en fractions de jours). */ int precision; double step = Math.abs(increment_); @@ -319,7 +343,7 @@ if (minimum_ < 1E-3 && minimum_ > -1E-3 && step <= 1E-3 && !format_.isParseIntegerOnly()) { sci = true; step = step * XMath.pow10(-XMath.log10(step)); - // format=new Decima + // format=new Decima } for (precision = 0; precision < 10; precision++) { final double check = Math.rint(step * 1E+4) % 1E+4; @@ -331,8 +355,7 @@ if (sci) { ((DecimalFormat) format_).applyPattern("0.###E0"); precision++; - } - else if (!format_.isParseIntegerOnly()) { + } else if (!format_.isParseIntegerOnly()) { ((DecimalFormat) format_).applyPattern("0.00"); } if (precision == 0 && step < 1E-4) { @@ -347,14 +370,12 @@ precision = s.length() - i; format_.setMinimumFractionDigits(precision); format_.setMaximumFractionDigits(precision); - } - else { + } else { format_.setMinimumFractionDigits(0); format_.setMaximumFractionDigits(30); } - } - else { - precision=computePrecision(precision); + } else { + precision = computePrecision(precision); format_.setMinimumFractionDigits(precision); format_.setMaximumFractionDigits(precision); } @@ -364,85 +385,84 @@ return formatValue(currentValue()); } - protected int computePrecision(final int _i){ - return _i; + int maxFractionDigits = -1; + + protected int computePrecision(final int _i) { + return maxFractionDigits >= 0 ? Math.min(maxFractionDigits, _i) : _i; } /** - * Returns the position where to draw the current tick. The position is scaled from the - * graduation's minimum to maximum. This is usually the same number than {@link #currentValue}. - * The mean exception is for logarithmic graduation, in which the tick position is not - * proportional to the tick value. + * Returns the position where to draw the current tick. The position is scaled from the graduation's minimum to + * maximum. This is usually the same number than {@link #currentValue}. The mean exception is for logarithmic + * graduation, in which the tick position is not proportional to the tick value. */ - public double currentPosition(){ + public double currentPosition() { return value_; } /** - * Retourne la valeur de la graduation courante. Cette m\xE9thode peut \xEAtre appel\xE9e pour une - * graduation majeure ou mineure. + * Retourne la valeur de la graduation courante. Cette m\xE9thode peut \xEAtre appel\xE9e pour une graduation majeure ou + * mineure. */ - public double currentValue(){ + public double currentValue() { return value_; } - public String formatSubValue(final double _v){ + public String formatSubValue(final double _v) { if (!formatValid_) { currentLabel(); } if (subFormat_ == null) { buildSubFormat(); } - if (subFormat_ == null) { - return Double.toString(_v); - } + if (subFormat_ == null) { return Double.toString(_v); } return subFormat_.format(_v); } - public String formatValue(final double _v){ + public String formatValue(final double _v) { if (!formatValid_) { currentLabel(); } return format_.format(_v); } - public double getIncrement(){ + public double getIncrement() { return increment_; } /** - * Indique s'il reste des graduations \xE0 retourner. Cette m\xE9thode retourne <code>true</code> tant - * que {@link #currentValue}ou {@link #currentLabel}peuvent \xEAtre appel\xE9es. + * Indique s'il reste des graduations \xE0 retourner. Cette m\xE9thode retourne <code>true</code> tant que + * {@link #currentValue}ou {@link #currentLabel}peuvent \xEAtre appel\xE9es. */ - public boolean hasNext(){ + public boolean hasNext() { return iterationDone_ < MAX_ITERATION && value_ <= maximum_; } /** * Initialise l'it\xE9rateur. + * * @param _minimum Valeur minimale de la premi\xE8re graduation. - * @param _maximum Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement - * cette valeur. + * @param _maximum Valeur limite des graduations. La derni\xE8re graduation n'aura pas n\xE9cessairement cette valeur. * @param _nbTick le nombre de graduation */ - public void init(final double _minimum,final double _maximum,final int _nbTick){ + public void init(final double _minimum, final double _maximum, final int _nbTick) { init(_minimum, _maximum, _nbTick <= 1 ? DEFAULT_STICK_NUMBER : _nbTick, 1); } /** * Indique si la graduation courante est une graduation majeure. - * @return <code>true</code> si la graduation courante est une graduation majeure, ou - * <code>false</code> si elle est une graduation mineure. + * + * @return <code>true</code> si la graduation courante est une graduation majeure, ou <code>false</code> si elle est + * une graduation mineure. */ - public boolean isMajorTick(){ + public boolean isMajorTick() { return subTickIndex_ == 0; } - - - public double getValueFromPosition(final double _v){ + public double getValueFromPosition(final double _v) { return _v; } + /** * Conventions \xE0 utiliser pour le formatage des nombres. */ @@ -450,17 +470,18 @@ * private Locale locale; */ - public final boolean isValid(){ + public final boolean isValid() { return formatValid_; } - public double getPositionFromValue(final double _v){ + public double getPositionFromValue(final double _v) { return _v; } + /** * Passe \xE0 la graduation suivante. */ - public void next(){ + public void next() { if (++subTickIndex_ >= subTickCount_) { subTickIndex_ = 0; iterationDone_++; @@ -473,7 +494,7 @@ /** * Passe directement \xE0 la graduation majeure suivante. */ - public void nextMajor(){ + public void nextMajor() { subTickIndex_ = 0; iterationDone_++; value_ = minimum_ + increment_ * (++tickIndex_); @@ -482,14 +503,14 @@ /** * Replace l'it\xE9rateur sur la premi\xE8re graduation. */ - public void rewind(){ + public void rewind() { iterationDone_ = 0; tickIndex_ = 0; subTickIndex_ = subTickStart_; value_ = minimum_ + increment_ * (subTickStart_ / (double) subTickCount_); } - public final void setValid(final boolean _formatValid){ + public final void setValid(final boolean _formatValid) { formatValid_ = _formatValid; } @@ -504,7 +525,7 @@ * Modifie les conventions \xE0 utiliser pour \xE9crire les \xE9tiquettes de graduation. */ /* - * public final void setLocale(final Locale locale){ if (!locale.equals(this.locale)) { - * this.locale = locale; this.format = null; formatValid = false; } } + * public final void setLocale(final Locale locale){ if (!locale.equals(this.locale)) { this.locale = locale; + * this.format = null; formatValid = false; } } */ } \ No newline at end of file Deleted: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorGraduationsFixe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorGraduationsFixe.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorGraduationsFixe.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -1,151 +0,0 @@ -package org.fudaa.ctulu.iterator; - -import java.text.DecimalFormat; - -/** - * Un iterator qui cree une grille avec exactement le meme nombre de graduations que sp\xE9cifi\xE9es. - * @author Adrien Hadoux - * - */ -public class NumberIteratorGraduationsFixe implements TickIterator { - /** - * Pour eviter les loop infinie. - */ - private static final int MAX_ITERATION = 500; - - /** - * Le nombre de graduations totales a ne pas d\xE9passer - */ - int nbGraduations_=10; - double min_; - double max_; - - /** - * Indice courant de la graduation. - */ - int current_=0; - - - /** - * La valeur de la droite de la grille - */ - double value_; - - - public NumberIteratorGraduationsFixe(){ - - } - - public String currentLabel() { - DecimalFormat df = new DecimalFormat("#.0"); - String currentLabel; - currentLabel = df.format(value_); - String chiffreApresVirgule = currentLabel.substring(currentLabel - .lastIndexOf(",") + 1); - if (chiffreApresVirgule.equals("0")) - currentLabel = "" + (int) value_; - return currentLabel; - } - - - public double currentPosition() { - - return current_; - } - - - public double currentValue() { - - return value_; - } - - public Object clone() throws CloneNotSupportedException{ - return null; - } - - - public String formatSubValue(double _v) { - - return null; - } - - - public String formatValue(double _v) { - - return null; - } - - - public double getIncrement() { - - return current_; - } - - - public double getPositionFromValue(double _v) { - - return 0; - } - - - public double getValueFromPosition(double _v) { - - return 0; - } - - - public boolean hasNext() { - if(current_>MAX_ITERATION) - return false; - if(current_<nbGraduations_ ){ - current_++; - return true; - } - return false; - } - - - public void init(double _min, double _max, int iteration) { - min_=_min; - max_=_max; - //-- nb iterations + 1 car utilise une graduation confondue --// - nbGraduations_=iteration+1; - current_=0; - value_=_min; - - - } - - public void init(double _min,double _max, double pasDeTemps){} - - - public boolean isMajorTick() { - // TODO Auto-generated method stub - return true; - } - - - public void next() { - - double distance = max_ - min_;// e - double taillePas = (distance / (nbGraduations_-1)); - - value_= (min_ + (taillePas * (current_))); - - } - - - - - public void nextMajor() { - // TODO Auto-generated method stub - next(); - } - - - public void rewind() { - current_--; - - } - -} Deleted: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorPasFixe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorPasFixe.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/NumberIteratorPasFixe.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -1,163 +0,0 @@ -package org.fudaa.ctulu.iterator; - -import java.text.DecimalFormat; - -/** -* Un iterator qui cree une grille avec exactement les graduations avec la m\xEAme longueur sp\xE9cifi\xE9es. -* @author Adrien Hadoux -* -*/ -public class NumberIteratorPasFixe implements TickIterator { - /** - * Pour eviter les loop infinie. - */ - private static final int MAX_ITERATION = 500; - - /** - * La longueur totale a ne pas depasser - */ - double longueurPas_; - double min_; - double max_; - - /** - * Le nombre de graduations total a r\xE9aliser est n\xE9cessaire pour indiquer qu'il prendre en compte le dernier trait m\xEAme si il d\xE9passe de la vue (si taille pas proportionnelle a longueur pas) - * Super utile pour les sous graduations - */ - int nbGraduations_; - - /** - * Indice courant de la graduation. - */ - int current_=0; - - - /** - * La valeur de la graduation - */ - double value_; - - - public NumberIteratorPasFixe(){ - - } - - public String currentLabel() { - DecimalFormat df = new DecimalFormat("#.0"); - String currentLabel; - currentLabel = df.format(value_); - String chiffreApresVirgule = currentLabel.substring(currentLabel - .lastIndexOf(",") + 1); - if (chiffreApresVirgule.equals("0")) - currentLabel = "" + (int) value_; - return currentLabel; - } - - - public double currentPosition() { - - return current_; - } - - - public double currentValue() { - - return value_; - } - - public Object clone() throws CloneNotSupportedException{ - return null; - } - - - public String formatSubValue(double _v) { - - return null; - } - - - public String formatValue(double _v) { - - return null; - } - - - public double getIncrement() { - - return current_; - } - - - public double getPositionFromValue(double _v) { - - return 0; - } - - - public double getValueFromPosition(double _v) { - - return 0; - } - - - public boolean hasNext() { - if(current_>MAX_ITERATION) - return false; - //-- Il faut penser a ses petits (les sous graduations)--// - if( current_==nbGraduations_-1 && value_<max_ ){ - nbGraduations_++; - } - - - if(current_<nbGraduations_){ - current_++; - return true; - } - return false; - } - - - public void init(double _min, double _max, int iteration) { - init(_min,_max,new Double(iteration).doubleValue()); - - } - - - public void init(double _min,double _max, double pasDeTemps){ - min_=_min; - max_=_max; - longueurPas_=pasDeTemps; - current_=0; - value_=_min; - //-- nb iterations + 1 car utilise une graduation confondue --// - - nbGraduations_=(int) ((max_ - min_)/longueurPas_)+1; - - } - - public boolean isMajorTick() { - // TODO Auto-generated method stub - return true; - } - - - public void next() { - - value_= min_ + (longueurPas_ * (current_)); - - - } - - - public void nextMajor() { - // TODO Auto-generated method stub - next(); - } - - - public void rewind() { - current_--; - - } - -} Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/TickIterator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/TickIterator.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/iterator/TickIterator.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -33,96 +33,108 @@ */ package org.fudaa.ctulu.iterator; - // Miscellaneous //import java.util.Locale; - /** - * Provides the mechanism for Graduation objects to return the - * values and labels of their ticks one tick at a time. This interface - * returns tick values from some minimal value up to some maximal value, - * using some increment value. Note that the increment value <strong>may - * not be constant</strong>. For example, a graduation for the time axis - * may use a slightly variable increment between differents months, since - * all months doesn't have the same number of days. - * + * Provides the mechanism for Graduation objects to return the values and labels of their ticks one tick at a time. This + * interface returns tick values from some minimal value up to some maximal value, using some increment value. Note that + * the increment value <strong>may not be constant</strong>. For example, a graduation for the time axis may use a + * slightly variable increment between differents months, since all months doesn't have the same number of days. + * * @version $Id: TickIterator.java,v 1.1 2007-01-17 10:45:26 deniger Exp $ * @author Martin Desruisseaux */ -public interface TickIterator extends Cloneable{ +public interface TickIterator extends Cloneable { /** * Le nombre de graduation par defaut. */ - int DEFAULT_STICK_NUMBER=10; - /** - * Tests if the iterator has more ticks. - */ - boolean hasNext(); + int DEFAULT_STICK_NUMBER = 10; - /** - * Tests if the current tick is a major one. - * - * @return <code>true</code> if current tick is a major tick, - * or <code>false</code> if it is a minor tick. - */ - boolean isMajorTick(); + /** + * Tests if the iterator has more ticks. + */ + boolean hasNext(); - /** - * Returns the position where to draw the current tick. The position is scaled - * from the graduation's minimum to maximum. This is usually the same number - * than {@link #currentValue}. The mean exception is for logarithmic graduation, - * in which the tick position is not proportional to the tick value. - */ - double currentPosition(); + /** + * Tests if the current tick is a major one. + * + * @return <code>true</code> if current tick is a major tick, or <code>false</code> if it is a minor tick. + */ + boolean isMajorTick(); - /** - * Returns the value for current tick. The - * current tick may be major or minor. - */ - double currentValue(); + /** + * Returns the position where to draw the current tick. The position is scaled from the graduation's minimum to + * maximum. This is usually the same number than {@link #currentValue}. The mean exception is for logarithmic + * graduation, in which the tick position is not proportional to the tick value. + */ + double currentPosition(); - Object clone() throws CloneNotSupportedException; + /** + * Returns the value for current tick. The current tick may be major or minor. + */ + double currentValue(); - /** - * Returns the label for current tick. This method is usually invoked - * only for major ticks, but may be invoked for minor ticks as well. - * This method returns <code>null</code> if it can't produces a label - * for current tick. - * @return the label for current tick - */ - String currentLabel(); + Object clone() throws CloneNotSupportedException; - /** - * @param _v a value - * @return the label for the value _v - */ - String formatValue(double _v); - String formatSubValue(double _v); - /** - * Moves the iterator to the next minor or major tick. - */ - void next(); + /** + * Returns the label for current tick. This method is usually invoked only for major ticks, but may be invoked for + * minor ticks as well. This method returns <code>null</code> if it can't produces a label for current tick. + * + * @return the label for current tick + */ + String currentLabel(); - /** - * Moves the iterator to the next major tick. This move - * ignore any minor ticks between current position and - * the next major tick. - */ - void nextMajor(); + /** + * @param _v a value + * @return the label for the value _v + */ + String formatValue(double _v); - /** - * Reset the iterator on its first tick. - * All other properties are left unchanged. - */ - void rewind(); + String formatSubValue(double _v); + /** + * Moves the iterator to the next minor or major tick. + */ + void next(); - double getIncrement(); - void init(double _min,double _max, int _nbIteration); - void init(double _min,double _max, double pasDeTemps); - double getValueFromPosition(double _v); - double getPositionFromValue(double _v); + /** + * Moves the iterator to the next major tick. This move ignore any minor ticks between current position and the next + * major tick. + */ + void nextMajor(); + /** + * Reset the iterator on its first tick. All other properties are left unchanged. + */ + void rewind(); + + double getIncrement(); + + /** + * Initialisation au mieux + * + * @param _min le min + * @param _max le max + * @param _nbIteration le nombre d'iteration voulu + */ + void init(double _min, double _max, int _nbIteration); + + /** + * Iniatialise exactement avec ces donn\xE9es + * + * @param _min + * @param _max + * @param _nbIteration + * @param _nbSousIteration + */ + void initExact(double _min, double _max, int _nbIteration, int _nbSousIteration); + + void initExactFromDist(double _min, double _max, double _increment, int _nbSousIteration); + + double getValueFromPosition(double _v); + + double getPositionFromValue(double _v); + } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-13 19:16:17 UTC (rev 4471) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZCalqueGrille.java 2009-02-15 23:05:09 UTC (rev 4472) @@ -18,17 +18,12 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; -import java.text.DecimalFormat; -import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; -import org.apache.tools.ant.filters.TailFilter; import org.fudaa.ctulu.CtuluLibString; import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.iterator.NumberIterator; -import org.fudaa.ctulu.iterator.NumberIteratorGraduationsFixe; -import org.fudaa.ctulu.iterator.NumberIteratorPasFixe; import org.fudaa.ctulu.iterator.TickIterator; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.commun.EbliUIProperties; @@ -44,1097 +39,1015 @@ /** * Un calque d'affichage d'une grille. * - * @version $Revision: 1.11.6.1 $ $Date: 2008-02-20 10:14:40 $ by $Author: - * bmarchan $ + * @version $Revision: 1.11.6.1 $ $Date: 2008-02-20 10:14:40 $ by $Author: bmarchan $ * @author Guillaume Desnoix */ public class ZCalqueGrille extends ZCalqueAffichageDonnees { - // Proprietes - // private GrBoite boite_; - boolean drawGrid_; - boolean drawX_ = true; - boolean drawY_ = true; - // Envelope customBounds_; - // boolean useCustom_; + // Proprietes + // private GrBoite boite_; + boolean drawGrid_; + boolean drawX_ = true; + boolean drawY_ = true; + // Envelope customBounds_; + // boolean useCustom_; - int nbGraduationX_ = 10; - int nbGraduationY_ = 10; + int nbGraduationX_ = 10; + int nbGraduationY_ = 10; - // -- sous graduations --// - int nbSousGraduationX_ = 3; - // -- sous graduations --// - int nbSousGraduationY_ = 3; + // -- sous graduations --// + int nbSousGraduationX_ = 3; + // -- sous graduations --// + int nbSousGraduationY_ = 3; - - private TraceLigneModel traceGraduations_=new TraceLigneModel(TraceLigne.TIRETE,1,Color.black); - private TraceLigneModel traceSousGraduations_=new TraceLigneModel(TraceLigne.TIRETE,(float)0.5,Color.gray); - - final BVueCalque vue_; + private TraceLigneModel traceGraduations_ = new TraceLigneModel(TraceLigne.TIRETE, 1, Color.black); + private TraceLigneModel traceSousGraduations_ = new TraceLigneModel(TraceLigne.TIRETE, (float) 0.5, Color.gray); - /** - * Indique la facon de calculer les graduations. pour l'axe des x. - */ - boolean modeAutomatiqueX_ = false; - /** - * Indique la facon de calculer les graduations. pour l'axe des y. - */ - boolean modeAutomatiqueY_ = false; + final BVueCalque vue_; - /** - * Indique si on utilise par taille de pas ou par nombre de graduations - */ - boolean modeLongueurPasX_ = false; - boolean modeLongueurPasY_ = false; + /** + * Indique la facon de calculer les graduations. pour l'axe des x. + */ + boolean modeAutomatiqueX_ = false; + /** + * Indique la facon de calculer les graduations. pour l'axe des y. + */ + boolean modeAutomatiqueY_ = false; - /** - * Valeur du pas que devront suivrent tous les traits de la grilles si on en - * mode taille pas. - */ - double valeurPasX_; - double valeurPasY_; + /** + * Indique si on utilise par taille de pas ou par nombre de graduations + */ + boolean modeLongueurPasX_ = false; + boolean modeLongueurPasY_ = false; - boolean drawSousGrilleX_ = false; - boolean drawSousGrilleY_ = false; + /** + * Valeur du pas que devront suivrent tous les traits de la grilles si on en mode taille pas. + */ + double valeurPasX_; + double valeurPasY_; - boolean modeLongueurPasSousGradX_ = false; - boolean modeLongueurPasSousGradY_ = false; + boolean drawSousGrilleX_ = false; + boolean drawSousGrilleY_ = false; - double valeurPasSousGradX_; - double valeurPasSousGradY_; + // boolean modeLongueurPasSousGradX_ = false; + // boolean modeLongueurPasSousGradY_ = false; + // + // double valeurPasSousGradX_; + // double valeurPasSousGradY_; - private Color couleurSousGraduation_ = Color.blue; +// private Color couleurSousGraduation_ = Color.blue; - public ZCalqueGrille(final BVueCalque _vue) { - super(); - vue_ = _vue; - setDestructible(false); - setName("cqGrille"); - setTitle(EbliLib.getS("Grille")); - // setForeground(new Color(204, 153, 0)); - setForeground(Color.BLACK); - } + public ZCalqueGrille(final BVueCalque _vue) { + super(); + vue_ = _vue; + setDestructible(false); + setName("cqGrille"); + setTitle(EbliLib.getS("Grille")); + // setForeground(new Color(204, 153, 0)); + setForeground(Color.BLACK); + } - public void paintAllInImage(final Graphics2D _g, - final GrMorphisme _versEcran, final GrMorphisme _versReel, - final GrBoite _clipReel) { - // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); - } + public void paintAllInImage(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + // super.paintAllInImage(_g, _versEcran, _versReel, _clipReel); + } - public void changeZoom(double minx, double miny, double maxx, double maxy) { - vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), - new GrPoint(maxx, maxy, 0)), false); - } + public void changeZoom(double minx, double miny, double maxx, double maxy) { + vue_.changeViewBoite(this, new GrBoite(new GrPoint(minx, miny, 0), new GrPoint(maxx, maxy, 0)), false); + } - public int getNbXGraduations() { - return nbGraduationX_; - } + public int getNbXGraduations() { + return nbGraduationX_; + } - public int getNbYGraduations() { - return nbGraduationY_; - } + public int getNbYGraduations() { + return nbGraduationY_; + } - public int getNbXSousGraduations() { - return nbSousGraduationX_; - } + public int getNbXSousGraduations() { + return nbSousGraduationX_; + } - public int getNbYSousGraduations() { - return nbSousGraduationY_; - } + public int getNbYSousGraduations() { + return nbSousGraduationY_; + } - public void setSousGraduationColor(Color c) { - if (couleurSousGraduation_ != c) { - couleurSousGraduation_ = c; - grilleChanged(); - } - } + /** + * Accesseur de la propriete <I>boite</I>. Elle donne la position, la taille, le domaine de la grille. + */ + // public GrBoite getBoite() { + // return boite_; + // } + public GrBoite getDomaine() { + return null; + // GrBoite r = null; + // if (isVisible()) { + // GrBoite d = null; + // d = super.getDomaine(); + // r = getBoite(); + // if (d != null) { + // if (r == null) { + // r = d; + // } else { + // r = r.union(d); + // } + // } + // } + // return r; + } - /** - * Accesseur de la propriete <I>boite</I>. Elle donne la position, la - * taille, le domaine de la grille. - */ - // public GrBoite getBoite() { - // return boite_; - // } - public GrBoite getDomaine() { - return null; - // GrBoite r = null; - // if (isVisible()) { - // GrBoite d = null; - // d = super.getDomaine(); - // r = getBoite(); - // if (d != null) { - // if (r == null) { - // r = d; - // } else { - // r = r.union(d); - // } - // } - // } - // return r; - } + public GrBoite getDomaineOnSelected() { + return getDomaine(); + } - public GrBoite getDomaineOnSelected() { - return getDomaine(); - } + public boolean isCouleurModifiable() { + return true; + } - public boolean isCouleurModifiable() { - return true; - } + public int getTiretLength() { + return 3; + } - public int getTiretLength() { - return 3; - } + public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, final GrMorphisme _versReel, + final GrBoite _clipReel) { + GrBoite domaine = vue_.getAbstractCalque().getDomaine(); + final GrBoite zv = _clipReel.intersectionXY(domaine); + // GrBoite domaine = vue_.getViewBoite(); + // final GrBoite zv = domaine; - public void paintDonnees(final Graphics2D _g, final GrMorphisme _versEcran, - final GrMorphisme _versReel, final GrBoite _clipReel) { - GrBoite domaine = vue_.getAbstractCalque().getDomaine(); - final GrBoite zv = _clipReel.intersectionXY(domaine); -// GrBoite domaine = vue_.getViewBoite(); -// final GrBoite zv = domaine; + if (zv == null) { return; } + // updateBounds(zv); + final GrBoite targetBoite = new GrBoite(); + targetBoite.ajuste(0, 0, 0); + // la boite d'affichage - if (zv == null) { - return; - } - // updateBounds(zv); - final GrBoite targetBoite = new GrBoite(); - targetBoite.ajuste(0, 0, 0); - // la boite d'affichage + if (!_versEcran.isSame(getVersEcran())) { return; } + targetBoite.ajuste(getWidth(), getHeight(), 0); + final Color old = _g.getColor(); + final Font oldFont = _g.getFont(); + // la fonte + final Font font = getFont(); + if (font != null) { + _g.setFont(font); + } + final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); + final TDoubleArrayList xValue = new TDoubleArrayList(20); + final TIntArrayList xStrWidth = new TIntArrayList(20); + final List xString = new ArrayList(20); - if (!_versEcran.isSame(getVersEcran())) { - return; - } - targetBoite.ajuste(getWidth(), getHeight(), 0); - final Color old = _g.getColor(); - final Font oldFont = _g.getFont(); - // la fonte - final Font font = getFont(); - if (font != null) { - _g.setFont(font); - } - final FontMetrics fm = font == null ? null : _g.getFontMetrics(font); - final TDoubleArrayList xValue = new TDoubleArrayList(20); - final TIntArrayList xStrWidth = new TIntArrayList(20); - final List xString = new ArrayList(20); - - final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() - && nbGraduationX_ > 0; + final boolean isXPainted = drawX_ && zv.getMinX() < zv.getMaxX() && nbGraduationX_ > 0; - if (isXPainted) { - computeXValues(zv, _g, xValue, xStrWidth, xString); - } - double yMax = 0; - final TDoubleArrayList yValue = new TDoubleArrayList(20); - final TIntArrayList yStrWidth = new TIntArrayList(20); - final List yString = new ArrayList(20); - final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() - && nbGraduationY_ > 0; - if (isYPainted) { - yMax = computeYValues(_g, zv, yValue, yStrWidth, yString); - } + if (isXPainted) { + computeXValues(zv, _g, xValue, xStrWidth, xString); + } + double yMax = 0; + final TDoubleArrayList yValue = new TDoubleArrayList(20); + final TIntArrayList yStrWidth = new TIntArrayList(20); + final List yString = new ArrayList(20); + final boolean isYPainted = drawY_ && zv.getMinY() < zv.getMaxY() && nbGraduationY_ > 0; + if (isYPainted) { + ... [truncated message content] |
From: <had...@us...> - 2009-02-13 19:16:23
|
Revision: 4471 http://fudaa.svn.sourceforge.net/fudaa/?rev=4471&view=rev Author: hadouxad Date: 2009-02-13 19:16:17 +0000 (Fri, 13 Feb 2009) Log Message: ----------- * Ajout des librairies pdf et ps pour les export (ps foireux....) * modification g?\195?\169n?\195?\169rales pour inclure ces formats dans tous les exports * ajout des formats a2,a3 et a4 ainsi que la possibilit?\195?\169 de choisir portrait ou landscape * calcul des pixels du format en fonction de la r?\195?\169solution ?\195?\169cran * pour la rotation :concat?\195?\169nation de 2 transformation affines * cr?\195?\169ation de m?\195?\169thode pour construire rapidement un rapport pdf * avancement sur les fl?\195?\168ches connectors. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-02-13 19:15:30 UTC (rev 4470) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/ZEbliCalquesPanel.java 2009-02-13 19:16:17 UTC (rev 4471) @@ -1073,7 +1073,7 @@ return conteneur; } - private JTable createTable() { + public JTable createTable() { final List<String> liste = new ArrayList<String>(infosCreation_.keySet()); Collections.sort(liste); final List<String> col = new ArrayList<String>(); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-02-13 19:15:30 UTC (rev 4470) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostLayoutPanelController.java 2009-02-13 19:16:17 UTC (rev 4471) @@ -67,6 +67,7 @@ import org.fudaa.fudaa.tr.post.actions.TrPostActionDuplicate; import org.fudaa.fudaa.tr.post.actions.TrPostActionDuplicateLayout; import org.fudaa.fudaa.tr.post.dialogSpec.TrPostWizardCreateScope; +import org.fudaa.fudaa.tr.post.rapport.TrPostRapportLayout; import org.netbeans.api.visual.widget.Widget; import com.memoire.bu.BuDesktop; @@ -332,8 +333,8 @@ nodeFleche.setTitle("Fleche simple"); // nodeFleche.setCreator(new EbliWidgetCreatorShape(new ShapeCreatorFlecheSimple())); - nodeFleche.setCreator(new EbliWidgetCreatorArrowEditor(new EbliEditorArrow())); - // nodeFleche.setCreator(new EbliWidgetCreatorConnectionWidget()); + // nodeFleche.setCreator(new EbliWidgetCreatorArrowEditor(new EbliEditorArrow())); + nodeFleche.setCreator(new EbliWidgetCreatorConnectionWidget()); nodeFleche.setPreferedSize(new Dimension(200, 150)); @@ -601,7 +602,7 @@ init.add(null); init.add(new TrPostWizardCreateScope.ImportAction(projet_)); - + //init.add((new TrPostRapportLayout(getSceneCourante())).getAction()); actions_ = Collections.unmodifiableList(init); } Added: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/rapport/TrPostRapportLayout.java 2009-02-13 19:16:17 UTC (rev 4471) @@ -0,0 +1,120 @@ +package org.fudaa.fudaa.tr.post.rapport; + +import java.awt.Dialog; +import java.awt.event.ActionEvent; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.util.HashMap; + +import javax.swing.JFileChooser; +import javax.swing.JTextField; + +import org.fudaa.ctulu.CtuluResource; +import org.fudaa.ctulu.gui.CtuluDialog; +import org.fudaa.ctulu.gui.CtuluDialogPanel; +import org.fudaa.ctulu.gui.CtuluLibSwing; +import org.fudaa.ctulu.image.CtuluPdfPsExport; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliWidget; +import org.fudaa.ebli.visuallibrary.calque.EbliWidgetVueCalque; +import org.fudaa.ebli.visuallibrary.graphe.EbliWidgetGraphe; +import org.fudaa.fudaa.tr.common.TrLib; +import org.fudaa.fudaa.tr.common.TrResource; +import org.fudaa.fudaa.tr.post.TrPostScene; +import org.netbeans.api.visual.widget.Widget; + +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfWriter; +import com.memoire.bu.BuGridLayout; +import com.memoire.bu.BuIcon; + +/** + * Genere un rapport a partir du layout. + * le rapport est en pdf + * @author Adrien Hadoux + * + */ +public class TrPostRapportLayout { + + TrPostScene scene_=null; + EbliActionSimple actionGenerate_; + public TrPostRapportLayout(TrPostScene scene){ + scene_=scene; + actionGenerate_=new EbliActionSimple(TrResource.getS("Rapport"),EbliResource.EBLI.getIcon("text"),"RAPPORTPDF"){ + public void actionPerformed(ActionEvent e){ + + JFileChooser chooser=new JFileChooser(); + int reponse=chooser.showOpenDialog(null); + if(reponse!= JFileChooser.APPROVE_OPTION) + return; + + File f=chooser.getSelectedFile(); + writeDoc(f); + } + }; + + } + + public EbliActionSimple getAction(){ + return actionGenerate_; + } + + + + void writeDoc(File file){ + Document document = new Document(); + + //-- ajout des infos relatives au document --// + document.addTitle(CtuluResource.CTULU.getString("Exportation PDF")); + document.addAuthor("FUDAA generating document"); + + try { + PdfWriter writer =PdfWriter.getInstance(document, new FileOutputStream(file)); + document.open(); + + int w=scene_.getView().getSize().width; + int h=scene_.getView().getSize().height; + CtuluPdfPsExport.addImageToPdf(scene_.produceImage(w,h, new HashMap()), writer, w, h); + + for(Widget widget:scene_.getChildren()){ + if(widget instanceof EbliWidget){ + EbliWidget wid=(EbliWidget)widget; + + if(wid.getIntern() instanceof EbliWidgetVueCalque){ + EbliWidgetVueCalque vue=(EbliWidgetVueCalque)wid.getIntern(); + CtuluPdfPsExport.addImageToPdf(vue.getCalquePanel().produceImage(new HashMap()), writer, vue.getCalquePanel().getSize().width,vue.getCalquePanel().getSize().height); + + CtuluPdfPsExport.addJTableToPdf(vue.getCalquePanel().createTable() , writer); + + }else + if(wid.getIntern() instanceof EbliWidgetGraphe){ + EbliWidgetGraphe vue=(EbliWidgetGraphe)wid.getIntern(); + CtuluPdfPsExport.addImageToPdf(vue.getGraphe().produceImage(new HashMap()), writer, vue.getGraphe().getSize().width,vue.getGraphe().getSize().height); + + //CtuluPdfPsExport.addJTableToPdf(vue.getGraphe().get , writer); + + } + + + } + } + + + + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (DocumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-02-13 19:15:35
|
Revision: 4470 http://fudaa.svn.sourceforge.net/fudaa/?rev=4470&view=rev Author: hadouxad Date: 2009-02-13 19:15:30 +0000 (Fri, 13 Feb 2009) Log Message: ----------- * Ajout des librairies pdf et ps pour les export (ps foireux....) * modification g?\195?\169n?\195?\169rales pour inclure ces formats dans tous les exports * ajout des formats a2,a3 et a4 ainsi que la possibilit?\195?\169 de choisir portrait ou landscape * calcul des pixels du format en fonction de la r?\195?\169solution ?\195?\169cran * pour la rotation :concat?\195?\169nation de 2 transformation affines * cr?\195?\169ation de m?\195?\169thode pour construire rapidement un rapport pdf * avancement sur les fl?\195?\168ches connectors. Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/ctulu_en.fr_txt branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageDimensionChooserPanel.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExport.java branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExportPanel.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/ctulu_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/ctulu_en.fr_txt 2009-02-13 15:45:15 UTC (rev 4469) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/ctulu_en.fr_txt 2009-02-13 19:15:30 UTC (rev 4470) @@ -277,4 +277,7 @@ Enregistrement dans le presse-papier=Save image in the clipboard Placer l'image de la fen\xEAtre active dans le presse-papier=Copy the image of the current frame in the clipboard Copier l'image dans le presse-papier=Copy the image in the clipboard -Cr\xE9er une image \xE0 partir de la fen\xEAtre active=Create an image from the current frama \ No newline at end of file +Cr\xE9er une image \xE0 partir de la fen\xEAtre active=Create an image from the current frama +Personalis\xE9=Personalised +Portrait=Portrait +payasage=landscape \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageDimensionChooserPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageDimensionChooserPanel.java 2009-02-13 15:45:15 UTC (rev 4469) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageDimensionChooserPanel.java 2009-02-13 19:15:30 UTC (rev 4470) @@ -8,10 +8,17 @@ package org.fudaa.ctulu.image; import java.awt.Dimension; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.print.attribute.standard.MediaSize; +import javax.print.attribute.standard.MediaSizeName; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JComponent; +import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -40,177 +47,309 @@ */ public class CtuluImageDimensionChooserPanel extends CtuluDialogPanel implements DocumentListener { - final JComponent tfWidth_; - final JComponent tfHeight_; - Dimension initDimension_; - final CtuluValueEditorInteger editor_; - final BuTransparentToggleButton cbLinked_; - float initRatio_; - final BuTransparentButton btDefaireWidth_; - final BuTransparentButton btDefaireHeight_; + final JComponent tfWidth_; + final JComponent tfHeight_; + Dimension initDimension_; + final CtuluValueEditorInteger editor_; + final BuTransparentToggleButton cbLinked_; + float initRatio_; + final BuTransparentButton btDefaireWidth_; + final BuTransparentButton btDefaireHeight_; + final JComboBox comboFormatStd_; + + private static String PERSONNALISE=CtuluResource.CTULU.getString("Personalis\xE9"); + private static String ISO_A4="A4"; + private static String ISO_A3="A3"; + private static String ISO_A2="A2"; + + private static String PORTRAIT=CtuluResource.CTULU.getString("Portrait"); + private static String LANDSCAPE=CtuluResource.CTULU.getString("Paysage"); + + JRadioButton typePortrait_=new JRadioButton(PORTRAIT,true); + JRadioButton typePaysage_=new JRadioButton(LANDSCAPE,false); + + + + String[] listeFormatSupported_={PERSONNALISE,ISO_A4,ISO_A3,ISO_A2}; - public CtuluImageDimensionChooserPanel() { - this(null); - } - public CtuluImageDimensionChooserPanel(final Dimension _init) { - super(); + public CtuluImageDimensionChooserPanel() { + this(null); + } - editor_ = new CtuluValueEditorInteger(false); - editor_.setEditable(true); - editor_.setVal(new CtuluValueValidator.IntMin(0)); - tfHeight_ = editor_.createEditorComponent(); - tfWidth_ = editor_.createEditorComponent(); - setLayout(new BuBorderLayout(0, 0, true, false)); - final BuPanel pn = new BuPanel(new BuGridLayout(2, 3, 3)); - addLabel(pn, CtuluLib.getS("Largeur")); - pn.add(tfWidth_); - addLabel(pn, CtuluLib.getS("Hauteur")); - pn.add(tfHeight_); - add(pn, BuBorderLayout.CENTER); - cbLinked_ = new BuTransparentToggleButton(CtuluResource.CTULU.getIcon("non-lie.png"), CtuluResource.CTULU - .getIcon("lie.png")); - cbLinked_.addActionListener(new ActionListener() { + public CtuluImageDimensionChooserPanel(final Dimension _init) { + super(); - public void actionPerformed(final ActionEvent _e) { - if (cbLinked_.isSelected()) { - widthValueChanged(); - } + editor_ = new CtuluValueEditorInteger(false); + editor_.setEditable(true); + editor_.setVal(new CtuluValueValidator.IntMin(0)); + tfHeight_ = editor_.createEditorComponent(); + tfWidth_ = editor_.createEditorComponent(); + setLayout(new BuBorderLayout(0, 0, true, false)); + final BuPanel pn = new BuPanel(new BuGridLayout(2, 3, 3)); + addLabel(pn, CtuluLib.getS("Format")); - } - }); - cbLinked_.setSelected(true); - add(cbLinked_, BuBorderLayout.EAST); - final BuIcon toolIcon = BuResource.BU.getToolIcon("defaire"); - btDefaireWidth_ = new BuTransparentButton(toolIcon); - btDefaireHeight_ = new BuTransparentButton(toolIcon); - final String tooltip = CtuluLib.getS("Reinitialiser avec la valeur initiale"); - btDefaireHeight_.setEnabled(false); - btDefaireWidth_.setEnabled(false); - tfWidth_.setLayout(new BuBorderLayout()); - tfWidth_.add(btDefaireWidth_, BuBorderLayout.EAST); - tfHeight_.setLayout(new BuBorderLayout()); - tfHeight_.add(btDefaireHeight_, BuBorderLayout.EAST); - btDefaireHeight_.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - refreshHeight(); - } - }); - btDefaireWidth_.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - refreshWidth(); - } - }); - ((BuTextField) tfHeight_).getDocument().addDocumentListener(this); - ((BuTextField) tfWidth_).getDocument().addDocumentListener(this); - setInitDimension(_init, true); - editor_.setValue(new Integer(initDimension_.width), tfWidth_); - editor_.setValue(new Integer(initDimension_.height), tfHeight_); - btDefaireWidth_.setToolTipText(tooltip + " (" + initDimension_.width + " )"); - btDefaireWidth_.setToolTipText(tooltip + " (" + initDimension_.height + " )"); - } - public final void setInitDimension(final Dimension _init, final boolean _force) { - initDimension_ = (_init == null || _init.width == 0 || _init.height == 0) ? new Dimension(100, 100) - : new Dimension(_init); - initRatio_ = CtuluLibImage.getRatio(initDimension_.width, initDimension_.height); - if (btDefaireHeight_ != null) { - updateBtHeight(); - } - if (btDefaireWidth_ != null) { - updateBtWidth(); - } - if (_force || !isWidthChanged() || !isHeigthChanged()) { - editor_.setValue(new Integer(initDimension_.width), tfWidth_); - editor_.setValue(new Integer(initDimension_.height), tfHeight_); - } - } + comboFormatStd_=new JComboBox(listeFormatSupported_); + comboFormatStd_.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e) { + selectionFormatStandard(comboFormatStd_.getSelectedIndex()); + } + }); + pn.add(comboFormatStd_); - public void changedUpdate(final DocumentEvent _e) { - update(_e.getDocument()); + ButtonGroup group=new ButtonGroup(); + group.add(typePaysage_); + group.add(typePortrait_); +// typePaysage_.addActionListener(new ActionListener(){ +// public void actionPerformed(ActionEvent e) { +// invertDimension(); +// } +// }); +// typePortrait_.addActionListener(new ActionListener(){ +// public void actionPerformed(ActionEvent e) { +// invertDimension(); +// } +// }); + addLabel(pn, CtuluLib.getS("Largeur")); + pn.add(tfWidth_); + addLabel(pn, CtuluLib.getS("Hauteur")); + pn.add(tfHeight_); + + pn.add(typePortrait_); + pn.add(typePaysage_); + + add(pn, BuBorderLayout.CENTER); + cbLinked_ = new BuTransparentToggleButton(CtuluResource.CTULU.getIcon("non-lie.png"), CtuluResource.CTULU + .getIcon("lie.png")); + cbLinked_.addActionListener(new ActionListener() { - } + public void actionPerformed(final ActionEvent _e) { + if (cbLinked_.isSelected()) { + widthValueChanged(); + } - public void insertUpdate(final DocumentEvent _e) { - update(_e.getDocument()); - } + } - public void removeUpdate(final DocumentEvent _e) { - update(_e.getDocument()); - } + }); + cbLinked_.setSelected(true); + add(cbLinked_, BuBorderLayout.EAST); + final BuIcon toolIcon = BuResource.BU.getToolIcon("defaire"); + btDefaireWidth_ = new BuTransparentButton(toolIcon); + btDefaireHeight_ = new BuTransparentButton(toolIcon); + final String tooltip = CtuluLib.getS("Reinitialiser avec la valeur initiale"); + btDefaireHeight_.setEnabled(false); + btDefaireWidth_.setEnabled(false); + tfWidth_.setLayout(new BuBorderLayout()); + tfWidth_.add(btDefaireWidth_, BuBorderLayout.EAST); + tfHeight_.setLayout(new BuBorderLayout()); + tfHeight_.add(btDefaireHeight_, BuBorderLayout.EAST); + btDefaireHeight_.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + refreshHeight(); + } + }); + btDefaireWidth_.addActionListener(new ActionListener() { + public void actionPerformed(final ActionEvent _e) { + refreshWidth(); + } + }); + ((BuTextField) tfHeight_).getDocument().addDocumentListener(this); + ((BuTextField) tfWidth_).getDocument().addDocumentListener(this); + setInitDimension(_init, true); + editor_.setValue(new Integer(initDimension_.width), tfWidth_); + editor_.setValue(new Integer(initDimension_.height), tfHeight_); + btDefaireWidth_.setToolTipText(tooltip + " (" + initDimension_.width + " )"); + btDefaireWidth_.setToolTipText(tooltip + " (" + initDimension_.height + " )"); - boolean update_; + } - private void update(final Document _src) { - if (_src == ((JTextField) tfHeight_).getDocument()) { - heightValueChanged(); - } else { - widthValueChanged(); - } + public final void setInitDimension(final Dimension _init, final boolean _force) { + initDimension_ = (_init == null || _init.width == 0 || _init.height == 0) ? new Dimension(100, 100) + : new Dimension(_init); + initRatio_ = CtuluLibImage.getRatio(initDimension_.width, initDimension_.height); + if (btDefaireHeight_ != null) { + updateBtHeight(); + } + if (btDefaireWidth_ != null) { + updateBtWidth(); + } + if (_force || !isWidthChanged() || !isHeigthChanged()) { + editor_.setValue(new Integer(initDimension_.width), tfWidth_); + editor_.setValue(new Integer(initDimension_.height), tfHeight_); + } + } - } + public void changedUpdate(final DocumentEvent _e) { + update(_e.getDocument()); - void widthValueChanged() { - updateBtWidth(); - if (!update_ && cbLinked_.isSelected()) { - update_ = true; - final Object integer = editor_.getValue(tfWidth_); - if (integer != null) { - editor_.setValue(new Integer((int) Math.floor(((Integer) integer).intValue() / initRatio_)), tfHeight_); - } - update_ = false; + } - } - } + public void insertUpdate(final DocumentEvent _e) { + update(_e.getDocument()); + } - void heightValueChanged() { - updateBtHeight(); - if (!update_ && cbLinked_.isSelected()) { - update_ = true; - final Object integer = editor_.getValue(tfHeight_); - if (integer != null) { - editor_.setValue(new Integer((int) Math.floor(initRatio_ * ((Integer) integer).intValue())), tfWidth_); - } - update_ = false; - } - } + public void removeUpdate(final DocumentEvent _e) { + update(_e.getDocument()); + } - final void updateBtWidth() { - btDefaireWidth_.setEnabled(isWidthChanged()); - } + boolean update_; - private boolean isWidthChanged() { - return initDimension_.width != getImageWidth(); - } + private void update(final Document _src) { + if (_src == ((JTextField) tfHeight_).getDocument()) { + heightValueChanged(); + } else { + widthValueChanged(); + } - final void updateBtHeight() { + } - btDefaireHeight_.setEnabled(isHeigthChanged()); - } + void widthValueChanged() { + updateBtWidth(); + if (!update_ && cbLinked_.isSelected()) { + update_ = true; + final Object integer = editor_.getValue(tfWidth_); + if (integer != null) { + editor_.setValue(new Integer((int) Math.floor(((Integer) integer).intValue() / initRatio_)), tfHeight_); + } + update_ = false; - private boolean isHeigthChanged() { - return initDimension_.height != getImageHeight(); - } + } + } - public int getImageHeight() { - final Object integer = editor_.getValue(tfHeight_); - return integer == null ? 0 : ((Integer) integer).intValue(); - } + void heightValueChanged() { + updateBtHeight(); + if (!update_ && cbLinked_.isSelected()) { + update_ = true; + final Object integer = editor_.getValue(tfHeight_); + if (integer != null) { + editor_.setValue(new Integer((int) Math.floor(initRatio_ * ((Integer) integer).intValue())), tfWidth_); + } + update_ = false; + } + } - public int getImageWidth() { - final Object integer = editor_.getValue(tfWidth_); - return integer == null ? 0 : ((Integer) integer).intValue(); - } + final void updateBtWidth() { + btDefaireWidth_.setEnabled(isWidthChanged()); + } - void refreshWidth() { - editor_.setValue(new Integer(initDimension_.width), tfWidth_); + private boolean isWidthChanged() { + return initDimension_.width != getImageWidth(); + } - } + final void updateBtHeight() { - void refreshHeight() { - editor_.setValue(new Integer(initDimension_.height), tfHeight_); - } + btDefaireHeight_.setEnabled(isHeigthChanged()); + } + private boolean isHeigthChanged() { + return initDimension_.height != getImageHeight(); + } + + public int getImageHeight() { + final Object integer = editor_.getValue(tfHeight_); + return integer == null ? 0 : ((Integer) integer).intValue(); + } + + public int getImageWidth() { + final Object integer = editor_.getValue(tfWidth_); + return integer == null ? 0 : ((Integer) integer).intValue(); + } + + void refreshWidth() { + editor_.setValue(new Integer(initDimension_.width), tfWidth_); + + } + + void refreshHeight() { + editor_.setValue(new Integer(initDimension_.height), tfHeight_); + } + + + + public boolean isPaysage(){ + return typePaysage_.isSelected(); + } + public boolean isPortrait(){ + return typePortrait_.isSelected(); + } + /** + * Classe qui remplit les param\xE8tres en fonction du format standard. + * @param selection + * @author Adrien Hadoux + */ + public void selectionFormatStandard(int selection) { + + if(selection==-1 || listeFormatSupported_.length<=selection) + return; + + //-- text bloqu\xE9 si on choisit un format standard --// + tfWidth_.setEnabled((selection==0)); + tfHeight_.setEnabled((selection==0)); + //-- cas personnalis\xE9 on ne fait plus rien, on a deja lib\xE9r\xE9 les textfields --// + if(selection==0){ + cbLinked_.setSelected(true); + return; + } + boolean lienProportionMemoire=cbLinked_.isSelected(); + //-- il faut enleever les proportions pour modifier proprement--// + cbLinked_.setSelected(false); + //-- recuperation des formats --// + MediaSize media=null; + + String format=listeFormatSupported_[selection]; + + if(ISO_A4.equals(format)){ + media=MediaSize.getMediaSizeForName(MediaSizeName.ISO_A4); + }else + if(ISO_A3.equals(format)){ + media=MediaSize.getMediaSizeForName(MediaSizeName.ISO_A3); + }else + if(ISO_A2.equals(format)){ + media=MediaSize.getMediaSizeForName(MediaSizeName.ISO_A2); + } + + //-- mettre a jour les valeurs --// + float newWidth=media.getX(MediaSize.MM); + float nw=media.getX(MediaSize.INCH); + + float newHeight=media.getY(MediaSize.MM); + float nh=media.getY(MediaSize.INCH); + + //-- on a la r\xE9solution dpi de l'ecran --// + int pixelParpouce= Toolkit.getDefaultToolkit().getScreenResolution(); + + //-- [taille en pixels] / [r\xE9solution en dpi] * 2,54 = [taille en centim\xE8tres] --// + //-- [taille en pixels]=[taille en centim\xE8tres]*[r\xE9solution en dpi]/2.54 --// + + int pixelW= (int) (newWidth/10*pixelParpouce/2.54); + int pixelH= (int) (newHeight/10*pixelParpouce/2.54); + + + editor_.setValue(new Integer((int)pixelH),tfHeight_); + editor_.setValue(new Integer((int)pixelW),tfWidth_); + + + //-- on remet les proportions comme c'\xE9tait avant --// + cbLinked_.setSelected(lienProportionMemoire); + + } + + /** + * appel\xE9 pour inverser les dimensions dans le cas switch paysage/portrait + */ + private void invertDimension(){ + boolean lienProportionMemoire=cbLinked_.isSelected(); + //-- il faut enleever les proportions pour modifier proprement--// + cbLinked_.setSelected(false); + int h=getImageHeight(); + int w=getImageWidth(); + editor_.setValue(new Integer(w),tfHeight_); + editor_.setValue(new Integer(h),tfWidth_); + //-- on remet les proportions comme c'\xE9tait avant --// + cbLinked_.setSelected(lienProportionMemoire); + } + } Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExport.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExport.java 2009-02-13 15:45:15 UTC (rev 4469) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExport.java 2009-02-13 19:15:30 UTC (rev 4470) @@ -20,6 +20,11 @@ import javax.imageio.ImageIO; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Paragraph; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; import com.memoire.bu.BuResource; import com.memoire.fu.FuLog; @@ -60,6 +65,12 @@ r.add(s); } } + + //-- ajout des formats pdf et ps --// + r.add(CtuluPdfPsExport.FORMATPdf); + r.add(CtuluPdfPsExport.FORMATPS); + + w = new String[r.size()]; r.toArray(w); Arrays.sort(w); @@ -85,10 +96,14 @@ public static boolean export(final RenderedImage _image, final File _targetFile, final String _format, final CtuluUI _ui) { try { - ImageIO.write(_image, _format, _targetFile); + if(CtuluPdfPsExport.isApdfPsFormat(_format)){ + CtuluPdfPsExport.write(_image, _targetFile, _format); + } + else + ImageIO.write(_image, _format, _targetFile); } catch (final IllegalArgumentException e) { return false; - } catch (final IOException _e) { + } catch (final Exception _e) { if (_ui == null) { FuLog.error("save image", _e); } else { @@ -97,6 +112,7 @@ return false; } + return true; } @@ -119,5 +135,10 @@ }); } + + + + + } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExportPanel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExportPanel.java 2009-02-13 15:45:15 UTC (rev 4469) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluImageExportPanel.java 2009-02-13 19:15:30 UTC (rev 4470) @@ -7,6 +7,14 @@ */ package org.fudaa.ctulu.image; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; +import java.awt.image.AffineTransformOp; +import java.awt.image.BufferedImage; +import java.awt.image.BufferedImageOp; +import java.awt.image.Raster; import java.awt.image.RenderedImage; import java.io.File; @@ -85,15 +93,37 @@ return super.valide(); } + /** + * Applique la creation des images producer a partir des dimensions pass\xE9es en parametres. + */ public void apply() { final File dest = pnFile_.getFile(); - - final RenderedImage i = producer_.produceImage(pnDim_.getImageWidth(), pnDim_.getImageHeight(), null); + final RenderedImage imageResult ; + if(pnDim_.isPortrait()){ + //-- cas classique portrait --// + int w=pnDim_.getImageWidth(); + int h=pnDim_.getImageHeight(); + imageResult = producer_.produceImage(w, h, null); + } + else{ + //-- cas paysage: --// + int h=pnDim_.getImageHeight(); + int w=pnDim_.getImageWidth(); + BufferedImage img= producer_.produceImage(h, w, null); +// //-- on dessinne l'image avec la bonne forme --// +// BufferedImage imageRotation = new BufferedImage(w, h, img.getType()); +// Graphics2D graphicsImageRotation = (Graphics2D)imageRotation.getGraphics(); +// int centreX=w/2; +// int centreY=h/2; +// graphicsImageRotation.rotate(3*Math.PI/2,centreX,centreY); +// graphicsImageRotation.drawImage(img,0,0,null); + imageResult =getRotateImage(img);//imageRotation; + } final CtuluTaskDelegate delegate = ui_.createTask(dest.getName()); delegate.start(new Runnable() { public void run() { - if (CtuluImageExport.export(i, dest, ext_, ui_)) { + if (CtuluImageExport.export(imageResult, dest, ext_, ui_)) { BuLib.invokeLater(new Runnable() { public void run() { ui_.message(dest.getName(), CtuluLib.getS("Enregistrement image r\xE9ussi"), true); @@ -104,4 +134,46 @@ }); } + + + private BufferedImage getRotateImage(BufferedImage img){ + AffineTransform at = new AffineTransform(); + // scale image + at.scale(1.0, 1.0); + // -- rotation 90 deg --// + at.rotate( Math.PI / 2.0, img.getWidth() / 2.0, img + .getHeight() / 2.0); + + /* + * translate to make sure the rotation doesn't cut off any image data + */ + AffineTransform translationTransform; + translationTransform = findTranslation(at, img); + at.preConcatenate(translationTransform); + + // instantiate and apply affine transformation filter + BufferedImageOp bio; + bio = new AffineTransformOp(at, AffineTransformOp.TYPE_BILINEAR); + + BufferedImage res = bio.filter(img, null); + + return res; + } + + + private AffineTransform findTranslation(AffineTransform at, BufferedImage bi) { + Point2D p2din, p2dout; + + p2din = new Point2D.Double(0.0, 0.0); + p2dout = at.transform(p2din, null); + double ytrans = p2dout.getY(); + + p2din = new Point2D.Double(0, bi.getHeight()); + p2dout = at.transform(p2din, null); + double xtrans = p2dout.getX(); + + AffineTransform tat = new AffineTransform(); + tat.translate(-xtrans, -ytrans); + return tat; + } } Added: branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ctulu/src/org/fudaa/ctulu/image/CtuluPdfPsExport.java 2009-02-13 19:15:30 UTC (rev 4470) @@ -0,0 +1,263 @@ +package org.fudaa.ctulu.image; + +import java.awt.Graphics2D; +import java.awt.Shape; +import java.awt.image.BufferedImage; +import java.awt.image.RenderedImage; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Collection; + +import javax.swing.JTable; + +import org.fudaa.ctulu.CtuluResource; + +import com.db4o.inside.Exceptions4; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.List; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfTemplate; +import com.lowagie.text.pdf.PdfWriter; +import com.rie.rieps.engine.Job; +import com.rie.rieps.engine.Page; +import com.rie.rieps.engine.image.SmallGrayImage; + +/** + * Classe qui g\xE8re l'exportation pdf et ps. + * utilise la librairie iText. + * @author Adrien Hadoux + */ +public class CtuluPdfPsExport { + + public static String FORMATPdf="pdf"; + public static String FORMATPS="ps"; + + /** + * Format A4 portait + */ + public static Rectangle FORMAT_A4_PORTRAIT=PageSize.A4.rotate(); + public static Rectangle FORMAT_A4=PageSize.A4; + + + public static void write(final RenderedImage _image, final File _targetFile, final String _format) throws DocumentException,IOException,Exception{ + + if(isApdfFormat(_format)) + writePDF(_image, _targetFile, _format); + else + if(isApsFormat(_format)) + writePostScript(_image, _targetFile, _format); + + } + /** + *Un lecteur pdf pour ecrire les images + *@author Adrien Hadoux + */ + public static void writePDF(final RenderedImage _image, final File _targetFile, final String _format) throws DocumentException,IOException{ + int w = _image.getWidth(); + int h = _image.getHeight(); + Document document = new Document(new Rectangle(w,h)); + //-- ajout des infos relatives au document --// + document.addTitle(CtuluResource.CTULU.getString("Exportation PDF")); + document.addAuthor("FUDAA generating document"); + try { + PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(_targetFile)); + document.open(); + PdfContentByte cb = writer.getDirectContent(); + PdfTemplate tp = cb.createTemplate(w, h); + Graphics2D graphics = tp.createGraphics(w, h); + //-- dessin de l'image --// + graphics.drawImage((BufferedImage)_image,0,0,null); + graphics.dispose(); + cb.addTemplate(tp, 0, 0); + } catch (DocumentException ex) { + throw ex; + } catch (IOException ex) { + throw ex; + }finally{ + document.close(); + } + } + + + + /** + *Un lecteur ps + *@author Adrien Hadoux + */ + public static void writePostScript(final RenderedImage _image, final File _targetFile, final String _format) throws Exception{ + //-- creaton de l'image ps--// + SmallGrayImage bwi = new SmallGrayImage(SmallGrayImage.CONVERT_MODE_AVERAGE); + bwi.load((BufferedImage) _image); + OutputStream os = new FileOutputStream(_targetFile); + + Job job = Job.createPSTopLeftOriginJob(os, 595, 842); + + // Set usable postscript fonts of the device + job.setAvailableDeviceFont(new String[]{"Times-Roman", "Helvetica", "Courier", "Times-Italic", "Times-Bold", "Helvetica-Bold"}); + + // Show the dialog box the link unkwown awt font to device postscript font + job.askForUnmappedAWTFont(true); + + // output the awt/postscript font links. + // The output is well formatted to be automatically loaded by the RiePS library + // for future jobs + job.echoFontMapping(true); + + // Open the job + job.open(); + + + // Create a 2 pages document into the job + com.rie.rieps.engine.Document doc = job.createDocument(1); + doc.open(); + + // create a page + Page p = doc.createPage(); + // insert the same page with a picture added + p.drawImage(500, 200, bwi, 100, 100); + doc.showPage(p); + + // close the document and the job + doc.close(); + job.close(); + + + } + + + /** + * Test si le format est un format pdf ou ps + * @param format + * @return + */ + public static boolean isApdfPsFormat(String format){ + return isApdfFormat(format) ||isApsFormat(format); + } + + public static boolean isApdfFormat(String format){ + return format.toLowerCase().equals(FORMATPdf); + } + + + + public static boolean isApsFormat(String format){ + return format.toLowerCase().equals(FORMATPS); + } + /** + * Methode qui ajoute le tableau de data dans le fichier pdf + * @param _data tableau de donn\xE9es + * @param _title titre du tableau + * @param _document document pdf + * @throws DocumentException + * @author Adrien Hadoux + */ + public static void addDataToDocPdf(Object[][] _data,String _title,Document _document) throws DocumentException{ + PdfPTable table = new PdfPTable(2); + //-- titre --// + PdfPCell cell = new PdfPCell(new Paragraph(_title)); + cell.setColspan(2); + table.addCell(cell); + //-- remplissage --// + for(int i=0;i<_data.length;i++) + for(int j=0;j<_data.length;i++) + table.addCell(_data[i][j].toString()); + _document.add(table); + } + + /** + * Methode qui ajoute le tableau de data dans le fichier pdf + * @param _data1 donnees colonnes 1 + * @param _data2 donnees colonnes 2 + * + * @param _title titre du tableau + * @param _document document pdf + * @throws DocumentException + * @author Adrien Hadoux + */ + public static void addDataToDocPdf(java.util.List _data1,java.util.List _data2,String _title,Document _document) throws DocumentException{ + + if(_data1.size()!=_data2.size()) + return; + + PdfPTable table = new PdfPTable(2); + //-- titre --// + PdfPCell cell = new PdfPCell(new Paragraph(_title)); + cell.setColspan(2); + table.addCell(cell); + //-- remplissage --// + for(int i=0;i<_data1.size();i++){ + table.addCell(_data1.get(i).toString()); + table.addCell(_data2.get(i).toString()); + + } + _document.add(table); + } + + /** + * Methode qui ajoute le tableau de data dans le fichier pdf + * @param data1 liste de listes + * @param title titre du tableau + * @param document document pdf + * @throws DocumentException + * @author Adrien Hadoux + */ + public static void addDataToDocPdf(java.util.List<java.util.List> _liste,String _title,Document _document) throws DocumentException{ + PdfPTable table = new PdfPTable(_liste.size()); + //-- titre --// + PdfPCell cell = new PdfPCell(new Paragraph(_title)); + cell.setColspan(_liste.size()); + table.addCell(cell); + //-- remplissage --// + for(java.util.List sousListe:_liste) + for(Object l:sousListe) + table.addCell(l.toString()); + + _document.add(table); + } + + + /** + * Methode qui ajoute le tableau jtable dans le fichier pdf + * @param jtable + * @author Adrien Hadoux + */ + + public static void addJTableToPdf(JTable _tableToadd,PdfWriter _writer){ + PdfContentByte cb = _writer.getDirectContent(); + cb.saveState(); + Graphics2D g2 = cb.createGraphicsShapes(500, 500); + cb.createGraphics(500, 500); + Shape oldClip = g2.getClip(); + g2.clipRect(0, 0, 500, 500); + _tableToadd.print(g2); + g2.setClip(oldClip); + g2.dispose(); + cb.restoreState(); + } + + + /** + * Methode qui ajoute une image dans le fichier pdf + * @param BufferedImage image a ins\xE9rer + * @author Adrien Hadoux + */ + public static void addImageToPdf(BufferedImage _img,PdfWriter _writer,int w,int h){ + PdfContentByte cb = _writer.getDirectContent(); + PdfTemplate tp = cb.createTemplate(w, h); + Graphics2D graphics = tp.createGraphics(w, h); + //-- dessin de l'image --// + graphics.drawImage(_img,0,0,null); + graphics.dispose(); + cb.addTemplate(tp, 0, 0); + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-02-13 15:45:20
|
Revision: 4469 http://fudaa.svn.sourceforge.net/fudaa/?rev=4469&view=rev Author: emmanuel_martin Date: 2009-02-13 15:45:15 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Modeleur 1d : Correction de l'undo/redo du z lors d'un d?\195?\169placement d'un point engendrant un erreur. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-13 15:33:04 UTC (rev 4468) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-13 15:45:15 UTC (rev 4469) @@ -963,9 +963,13 @@ public void setValues(int _idxPoint, double _valueCurv, double _valueZ, CtuluCommandContainer _cmd) throws ProfilContainerException{ CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un point")); setZ(_idxPoint, _valueZ, cmd); - setCurv(_idxPoint, _valueCurv, cmd); - if(_cmd!=null) - _cmd.addCmd(cmd.getSimplify()); + try { + setCurv(_idxPoint, _valueCurv, cmd); + } + finally{ + if(_cmd!=null) + _cmd.addCmd(cmd.getSimplify()); + } } public void remove(int _idxPoint, CtuluCommandContainer _cmd) throws ProfilContainerException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-02-13 15:33:09
|
Revision: 4468 http://fudaa.svn.sourceforge.net/fudaa/?rev=4468&view=rev Author: emmanuel_martin Date: 2009-02-13 15:33:04 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Modeleur 1d : la trace de profil lors de l'exportation somporte jusqu'?\195?\160 4 points. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java 2009-02-13 15:28:57 UTC (rev 4467) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java 2009-02-13 15:33:04 UTC (rev 4468) @@ -20,8 +20,7 @@ import org.fudaa.ctulu.fileformat.FortranInterface; import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISAttributeModelDoubleInterface; -import org.fudaa.ctulu.gis.GISGeometryFactory; -import org.fudaa.ctulu.gis.GISPoint; +import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.dodico.commun.DodicoLib; @@ -218,11 +217,20 @@ throw new MascaretDataError("Un profil \xE0 plusieurs ou aucun point(s) d'intersection(s) avec l'axe hydraulique."); profilAbs.coordIntersectionAxeHydraulique=new double[]{intersection.getCoordinate().x, intersection.getCoordinate().y}; // Abscisse curviligne axe hydraulique + int idxAttrCommHydraulique=zoneProfil.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + if(idxAttrCommHydraulique==-1) + throw new MascaretDataError("L'attribut COMMENTAIRE_HYDRO doit \xEAtre pr\xE9sent."); + String comm=(String) zoneProfil.getValue(idxAttrCommHydraulique, idxProfil); + if(!GISLib.isHydroCommentValued(comm, "PK")) + throw new MascaretDataError("La propri\xE9t\xE9 PK de COMMENTAIRE_HYDRO doit \xEAtre valu\xE9e."); + profilAbs.abscisseCurvilingeAxeHydraulique=GISLib.getHydroCommentDouble(comm, "PK"); CoordinateSequence coordSeq=axeHydraulique.getCoordinateSequence(); - profilAbs.abscisseCurvilingeAxeHydraulique=absCurv(coordSeq, intersection.getCoordinate()); // Trace profil coordSeq=profil.getCoordinateSequence(); + Coordinate coord[]=getPointsRuptures(coordSeq); profilAbs.coordXYTraceProfil.add(new double[]{coordSeq.getX(0), coordSeq.getY(0)}); + for(int j=0;j<coord.length;j++) + profilAbs.coordXYTraceProfil.add(new double[]{coord[j].x, coord[j].y}); profilAbs.coordXYTraceProfil.add(new double[]{coordSeq.getX(coordSeq.size()-1), coordSeq.getY(coordSeq.size()-1)}); // Information atomiques sur le profil \\ @@ -325,20 +333,124 @@ } /** - * Calcul l'abscisse curviligne du point indiqu\xE9 en param\xE8tre + * Retourne la liste des points de ruptures. */ - private double absCurv(CoordinateSequence _coordSeq, Coordinate _point){ - int k=idxIntersection(_coordSeq, _point); - // Calcule de l'abscisse curviligne - double valueCurviligne=0; - for (int j=1; j<=k; j++) - valueCurviligne+=_coordSeq.getCoordinate(j).distance(_coordSeq.getCoordinate(j-1)); - // Mise \xE0 jour de l'abscisse curviligne - valueCurviligne+=_coordSeq.getCoordinate(k).distance(_point); - return valueCurviligne; + private Coordinate[] getPointsRuptures(CoordinateSequence _seq) { + List<Coordinate> coord=new ArrayList<Coordinate>(); + int idx1=0; + int idx2=1; + int idx3=2; + int idxPointRupturePrecedent=-1; + while(idx3<_seq.size()) { + if(idx1==idx2) + idx2++; + else if(idx2==idx3) + idx3++; + else if(_seq.getCoordinate(idx1).equals(_seq.getCoordinate(idx2))) + idx2++; + else if(_seq.getCoordinate(idx2).equals(_seq.getCoordinate(idx3))) + idx3++; + else { + if(getAngle(_seq.getCoordinate(idx1), _seq.getCoordinate(idx2), _seq.getCoordinate(idx3))<(Math.PI-0.0001)) + if(idxPointRupturePrecedent<0||!_seq.getCoordinate(idxPointRupturePrecedent).equals(_seq.getCoordinate(idx2))) + coord.add(_seq.getCoordinate(idx2)); + if(idx2+1<idx3) + idx2++; + else + idx1=idx2; + } + } + return coord.toArray(new Coordinate[0]); } /** + * Retourne l'angle form\xE9 par les segments _a_b et _b_c. _a, _b et _c doivent + * \xEAtre non confondus sous peine d'avoir un {@link IllegalArgumentException}. + * L'angle est toujours positif. + * L'ordonn\xE9 z n'est pas prise en compte. + * L'angle retourn\xE9 est en radian. + */ + private double getAngle(Coordinate _a, Coordinate _b, Coordinate _c) { + Coordinate a=new Coordinate(_a.x, _a.y, 0); + Coordinate b=new Coordinate(_b.x, _b.y, 0); + Coordinate c=new Coordinate(_c.x, _c.y, 0); + if(egal(a, b)||egal(b, c)||egal(a, c)) + throw new IllegalArgumentException("Les trois points doivent \xEAtre non confonus."); + // Projection de b sur ac + Coordinate b2=proj(b, a, c); + // Calcul des angles interm\xE9diaires + double angleCBB2=Math.asin(b2.distance(c)/c.distance(b)); + double angleB2BA=Math.asin(b2.distance(a)/a.distance(b)); + if(angleCBB2==Double.NaN||angleB2BA==Double.NaN) + return Math.PI; + // Selon que B2 appartient ou non \xE0 ac, la d\xE9termination de l'angle final diff\xE8re. + double angle; + int position=getPositionXY(b2, a, c); + if(position==-1) + angle=angleCBB2-angleB2BA; + else if(position==1) + angle=angleB2BA-angleCBB2; + else + angle=angleCBB2+angleB2BA; + return angle; + } + + /** + * Soit _a, _b, _c align\xE9s et non confondus. Retourne -1 si _a avant _b_c, 0 + * si _a est entre _b_c (inclu), +1 sinon. Si _a, _b et _c ne sont pas + * align\xE9s, {@link IllegalArgumentException} est lev\xE9. + */ + private int getPositionXY(Coordinate _a, Coordinate _b, Coordinate _c) { + if(!egal(proj(_a, _b, _c), _a)||egal(_a, _b)||egal(_b, _c)||egal(_a, _c)) + throw new IllegalArgumentException("Les trois points doivent \xEAtre align\xE9s et non confonus."); + Coordinate vecBC=vec(_b, _c); + double k; + if(vecBC.x!=0) + k=(_a.x-_b.x)/vecBC.x; + else + k=(_a.y-_b.y)/vecBC.y; + if(k<0) + return -1; + else if(k>1) + return 1; + else + return 0; + } + + /** + * Retourne la projection de _a sur la droite _b_c. + * Attention : Il s'agit bien d'une projection sur une + * droite et non un segment de droite : le r\xE9sultat + * peut \xEAtre en dehors de [_b, _c] + */ + private Coordinate proj(Coordinate _a, Coordinate _b, Coordinate _c){ + Coordinate vBC=vec(_b, _c); + Coordinate vBA=vec(_b, _a); + double normeBC=Math.sqrt(vBC.x*vBC.x+vBC.y*vBC.y+vBC.z*vBC.z); + double produitScalaireBCBA=vBC.x*vBA.x+vBC.y*vBA.y+vBC.z*vBA.z; + double rapportSurBC=produitScalaireBCBA/(normeBC*normeBC); + return new Coordinate(vBC.x*rapportSurBC+_b.x, vBC.y*rapportSurBC+_b.y, vBC.z*rapportSurBC+_b.z); + } + + /** + * Compars les deux vecteurs avec la tol\xE9rance donn\xE9e. Le dernier param\xE8tre + * indique si un normalisation des deux vecteurs doit \xEAtre faite avec la + * comparaison. Les vecteurs ne sont pas modif\xE9s dans l'op\xE9ration. _testZ doit + * \xEAtre mit \xE0 vrai pour que la comparaison tienne compte du z. + */ + private boolean egal(Coordinate _a, Coordinate _b) { + Coordinate diff=vec(_a, _b); + return Math.abs(diff.x)<0.0001&&Math.abs(diff.y)<0.0001; + } + + /** + * retourne le vecteur _a, _b sous forme de Coordinate. + */ + private Coordinate vec(Coordinate _a, Coordinate _b){ + return new Coordinate(_b.x-_a.x, _b.y-_a.y, _b.z-_a.z); + } + + /** * Calcul l'abscisse curviligne du point indiqu\xE9 en param\xE8tre */ private double absCurv(CoordinateSequence _coordSeq, int _idxPoint){ @@ -349,19 +461,4 @@ valueCurviligne+=_coordSeq.getCoordinate(j).distance(_coordSeq.getCoordinate(j-1)); return valueCurviligne; } - - /** - * Retourne l'indice pr\xE9c\xE9dent d'un point d'intersectin avec une geometrie. - */ - private int idxIntersection(CoordinateSequence _coordSeq, Coordinate _point){ - /* Recherche de l'index du dernier point de la polyligne \xE0 prendre en - * compte. */ - boolean fini=false; - int k=-1; - GISPoint point= new GISPoint(_point); - while (!fini&&++k<_coordSeq.size()-1) - fini=(GISGeometryFactory.INSTANCE - .createLineString(new Coordinate[]{_coordSeq.getCoordinate(k), _coordSeq.getCoordinate(k+1)})).intersects(point); - return k; - } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-02-13 15:28:57 UTC (rev 4467) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-02-13 15:33:04 UTC (rev 4468) @@ -52,7 +52,7 @@ GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{seq.getCoordinate(i), seq.getCoordinate(i+1)})) .getNumPoints()>1) ok=false; - // Aucun point d'intersectin avec les axes qui suivent + // Aucun point d'intersection avec les axes qui suivent int j=i; while (ok&&++j+1<seq.size()) ok=!mainAxe.intersects(GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{seq.getCoordinate(j), @@ -65,49 +65,30 @@ // / D\xE9termination des points de ruptures et verification qu'il y en a // au maximun deux. \\\ int nbPointsRupture=0; - double upsilon=0.0001; // Marge d'erreur des calculs sur double - double coefDirecteur=0; - // coefDirX : Indique si le coefficient directeur est calcul\xE9 sur les x - // ou sur les y (au d\xE9nominateur). - boolean coefDirX; - // Initialisation : calcul du premier cofficient directeur \\ - int idx=1; - // Calcul du coefficient directeur - if (seq.getX(idx)!=seq.getX(idx-1)) { - // Calcul sur les x - coefDirX=true; - coefDirecteur=(seq.getY(idx)-seq.getY(idx-1))/(seq.getX(idx)-seq.getX(idx-1)); - } - else { - // Calcul sur les y - coefDirX=false; - coefDirecteur=0; - } - // Coeur : Calcul de tous les coefficients directeur et m\xE9morisation des - // ruptures \\ - for (idx=2; idx<seq.size(); idx++) { - double newCoefDirecteur; - boolean newCoefDirX; - // Calcul du coefficient directeur - if (seq.getX(idx)!=seq.getX(idx-1)) { - // Calcul sur les x - newCoefDirX=true; - newCoefDirecteur=(seq.getY(idx)-seq.getY(idx-1))/(seq.getX(idx)-seq.getX(idx-1)); - } + int idx1=0; + int idx2=1; + int idx3=2; + int idxPointRupturePrecedent=-1; + while(idx3<seq.size()) { + if(idx1==idx2) + idx2++; + else if(idx2==idx3) + idx3++; + else if(seq.getCoordinate(idx1).equals(seq.getCoordinate(idx2))) + idx2++; + else if(seq.getCoordinate(idx2).equals(seq.getCoordinate(idx3))) + idx3++; else { - // Calcul sur les y - newCoefDirX=false; - newCoefDirecteur=0; - } - // D\xE9tection des ruptures - if (coefDirX!=newCoefDirX||Math.abs(coefDirecteur-newCoefDirecteur)>upsilon) { - nbPointsRupture++; + if(UtilsProfil1d.getAngle(seq.getCoordinate(idx1), seq.getCoordinate(idx2), seq.getCoordinate(idx3))<(Math.PI-0.0001)) + if(idxPointRupturePrecedent<0||!seq.getCoordinate(idxPointRupturePrecedent).equals(seq.getCoordinate(idx2))) + nbPointsRupture++; if (nbPointsRupture>2) return false; + if(idx2+1<idx3) + idx2++; + else + idx1=idx2; } - // Pr\xE9paration de l'it\xE9ration suivante - coefDirecteur=newCoefDirecteur; - coefDirX=newCoefDirX; } return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-02-13 15:29:03
|
Revision: 4467 http://fudaa.svn.sourceforge.net/fudaa/?rev=4467&view=rev Author: bmarchan Date: 2009-02-13 15:28:57 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Suppression du Z sur rives et zones de stockage. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dBank.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dLimiteStockage.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dBank.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dBank.java 2009-02-13 14:21:17 UTC (rev 4466) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dBank.java 2009-02-13 15:28:57 UTC (rev 4467) @@ -13,9 +13,9 @@ import org.fudaa.ebli.calque.ZModelGeometryListener; /** - * Un mod\xE8le de gestion de rive. + * Un mod\xE8le de gestion de rive. Les rives sont des polylignes X,Y non ferm\xE9es. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class MdlModel1dBank extends MdlModel2dLine { @@ -26,7 +26,6 @@ public MdlModel1dBank(final ZModelGeometryListener _listener, final CtuluCommandContainer _cmd) { super(_listener); GISAttribute[] attrs=new GISAttribute[]{ - GISAttributeConstants.BATHY, GISAttributeConstants.ETAT_GEOM, GISAttributeConstants.TITRE, GISAttributeConstants.NATURE, @@ -34,7 +33,6 @@ }; // Pas de container de commande pour cette op\xE9ration, sinon conserv\xE9 en undo/redo. getGeomData().setAttributes(attrs, null); - getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); getGeomData().setFixedAttributeValue(GISAttributeConstants.NATURE, GISAttributeConstants.ATT_NATURE_RV); } } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dLimiteStockage.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dLimiteStockage.java 2009-02-13 14:21:17 UTC (rev 4466) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/layer/MdlModel1dLimiteStockage.java 2009-02-13 15:28:57 UTC (rev 4467) @@ -14,11 +14,11 @@ import org.fudaa.ebli.calque.ZModelGeometryListener; /** - * Un mod\xE8le de calque pour le calque 2D des lignes de constraintes. Les lignes - * sont des polylignes XYZ, non ferm\xE9es. + * Un mod\xE8le de calque pour le calque 2D des limites de stockage. Les lignes + * sont des polylignes XY, non ferm\xE9es. * * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class MdlModel1dLimiteStockage extends MdlModel2dLine { @@ -30,12 +30,14 @@ */ public MdlModel1dLimiteStockage(final ZModelGeometryListener _listener, final CtuluCommandContainer _cmd) { super(_listener); - GISAttribute[] attrs=new GISAttribute[]{GISAttributeConstants.BATHY, GISAttributeConstants.ETAT_GEOM, - GISAttributeConstants.TITRE, GISAttributeConstants.NATURE, GISAttributeConstants.VISIBILITE}; + GISAttribute[] attrs=new GISAttribute[]{ + GISAttributeConstants.ETAT_GEOM, + GISAttributeConstants.TITRE, + GISAttributeConstants.NATURE, + GISAttributeConstants.VISIBILITE}; // Pas de container de commande pour cette op\xE9ration, sinon conserv\xE9 en // undo/redo. getGeomData().setAttributes(attrs, null); - getGeomData().setAttributeIsZ(GISAttributeConstants.BATHY); getGeomData().setFixedAttributeValue(GISAttributeConstants.NATURE, GISAttributeConstants.ATT_NATURE_LS); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-02-13 14:21:22
|
Revision: 4466 http://fudaa.svn.sourceforge.net/fudaa/?rev=4466&view=rev Author: emmanuel_martin Date: 2009-02-13 14:21:17 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Modeleur 1d : correction d'une absence de mise ?\195?\160 jour de l'interface lors d'un d?\195?\169placement de label. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-13 13:56:30 UTC (rev 4465) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-13 14:21:17 UTC (rev 4466) @@ -390,10 +390,30 @@ int[] allowed=getAllowedMoveOfLignesDirectricesTo(_idxDestination); if(allowed==null||!UtilsProfil1d.in(_idxLd, allowed)) throw new IllegalArgumentException(FudaaLib.getS("Ce d\xE9placement n'est pas permis")); + class UndoRedoSetLigneDirectriceAt implements CtuluCommand, CtuluNamedCommand { + CtuluCommandComposite cmd_; + public UndoRedoSetLigneDirectriceAt(CtuluCommandComposite _cmd) { + cmd_=_cmd; + } + public String getName() { + return FudaaLib.getS("D\xE9placement de ligne directrice"); + } + public void redo() { + cmd_.redo(); + fireProfilContainerDataModified(); + } + public void undo() { + cmd_.undo(); + fireProfilContainerDataModified(); + } + } GISAttributeModelIntegerList lst=(GISAttributeModelIntegerList)getValueOf(GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); // Changement de la valeur - lst.set(_idxLd, _idxDestination, _cmd); + CtuluCommandComposite cmd=new CtuluCommandComposite(); + lst.set(_idxLd, _idxDestination, cmd); fireProfilContainerDataModified(); + if(_cmd!=null) + _cmd.addCmd(new UndoRedoSetLigneDirectriceAt(cmd)); } public String getLigneDirectriceName(int _idx) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-02-13 13:56:37
|
Revision: 4465 http://fudaa.svn.sourceforge.net/fudaa/?rev=4465&view=rev Author: emmanuel_martin Date: 2009-02-13 13:56:30 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Modeleur 1d : lors de l'export un message indique le nombre de profil non export?\195?\169. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java 2009-02-13 13:45:11 UTC (rev 4464) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/mascaret/io/MascaretWriter.java 2009-02-13 13:56:30 UTC (rev 4465) @@ -24,6 +24,7 @@ import org.fudaa.ctulu.gis.GISPoint; import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.dodico.commun.DodicoLib; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; @@ -174,15 +175,21 @@ // Recherche des profils \\ List<GISZoneCollection> profils=new ArrayList<GISZoneCollection>(); List<Integer> indexProfils=new ArrayList<Integer>(); + int nbProfilNotKeep=0; for (int i=0; i<_zones.length; i++) { int idxAttNature=_zones[i].getIndiceOf(GISAttributeConstants.NATURE); if (idxAttNature!=-1) for (int j=0; j<_zones[i].getNbGeometries(); j++) - if (_zones[i].getValue(idxAttNature, j)==GISAttributeConstants.ATT_NATURE_PF&&_selectorProfil.exportProfil(_zones[i], i)) { - profils.add(_zones[i]); - indexProfils.add(j); + if (_zones[i].getValue(idxAttNature, j)==GISAttributeConstants.ATT_NATURE_PF) { + if(_selectorProfil.exportProfil(_zones[i], j)) { + profils.add(_zones[i]); + indexProfils.add(j); + } + else + nbProfilNotKeep++; } } + analyze_.addWarn(DodicoLib.getS(nbProfilNotKeep+" profils sur "+(indexProfils.size()+nbProfilNotKeep)+" non \xE9crit car non conformes."), -1); // G\xE9n\xE9ration des MascaretProfilAbstractRepresentations \\ profils_=new MascaretProfilAbstractRepresentation[profils.size()]; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-02-13 13:45:11 UTC (rev 4464) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/Controller1d.java 2009-02-13 13:56:30 UTC (rev 4465) @@ -395,9 +395,12 @@ appli_.error(message); } if (result.containsMessages()) { - for (int i=0; i<result.getAnalyze().getInfos().length; i++) - message+=result.getAnalyze().getInfos()[i].getMessage()+'\n'; - + if(result.getAnalyze().containsInfos()) + for (int i=0; i<result.getAnalyze().getInfos().length; i++) + message+=result.getAnalyze().getInfos()[i].getMessage()+'\n'; + if(result.getAnalyze().containsWarnings()) + for (int i=0; i<result.getAnalyze().getWarnings().length; i++) + message+=result.getAnalyze().getWarnings()[i].getMessage()+'\n'; } if(result.containsFatalError()) appli_.error(FudaaLib.getS("Exportation"), message); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-02-13 13:45:20
|
Revision: 4464 http://fudaa.svn.sourceforge.net/fudaa/?rev=4464&view=rev Author: bmarchan Date: 2009-02-13 13:45:11 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Correction rendre rectiligne des polylignes. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2009-02-13 13:30:34 UTC (rev 4463) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/MdlSceneEditor.java 2009-02-13 13:45:11 UTC (rev 4464) @@ -442,25 +442,25 @@ * Rend rectiligne une polyligne. */ public void linearisePolyligne() { - CtuluCommandComposite cmd=new CtuluCommandComposite(); - int[] geoms=getScene().getSelectionHelper().getSelectedIndexes(); + CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("Rendre rectiligne des polylignes")); + int[] idxGeoms=getScene().getSelectionHelper().getSelectedIndexes(); // Verification de la selection \\ boolean selectionValid=true; int w=-1; - while(selectionValid&&++w<geoms.length) - selectionValid=getScene().getObject(geoms[w]) instanceof GISPolyligne; + while(selectionValid&&++w<idxGeoms.length) + selectionValid=getScene().getObject(idxGeoms[w]) instanceof GISPolyligne; if(selectionValid){ // Pour chaque polyligne selectionn\xE9es - for (int i : geoms) { - int idxGeom=getScene().sceneId2LayerId(i); + for (int idxGeom : idxGeoms) { + int idx=getScene().sceneId2LayerId(idxGeom); GISPolyligne polyligne=((GISPolyligne)getScene().getObject(idxGeom)); - ZCalqueAffichageDonneesInterface calque=getScene().getLayerForId(i); + ZCalqueAffichageDonneesInterface calque=getScene().getLayerForId(idxGeom); GISZoneCollectionLigneBrisee zone=(GISZoneCollectionLigneBrisee) ((ZModeleEditable)calque.modeleDonnees()).getGeomData(); - if (getScene().isAtomicMode()&&getScene().getLayerSelectionMulti().getSelection(i).getNbSelectedIndex()>1) - LibUtils.linearisePolyligne(zone, idxGeom, getScene().getLayerSelectionMulti().getSelection(i).getSelectedIndex(), cmd); + if (getScene().isAtomicMode()&&getScene().getLayerSelectionMulti().getSelection(idxGeom).getNbSelectedIndex()>1) + LibUtils.linearisePolyligne(zone, idx, getScene().getLayerSelectionMulti().getSelection(idxGeom).getSelectedIndex(), cmd); else - LibUtils.linearisePolyligne(zone, idxGeom, new int[]{0, polyligne.getNumPoints()-1}, cmd); + LibUtils.linearisePolyligne(zone, idx, new int[]{0, polyligne.getNumPoints()-1}, cmd); } } // Mise \xE0 jour du undo/redo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-02-13 13:30:37
|
Revision: 4463 http://fudaa.svn.sourceforge.net/fudaa/?rev=4463&view=rev Author: emmanuel_martin Date: 2009-02-13 13:30:34 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Modeleur 1D : Suppression de la contraite de non pr?\195?\169sence de points supprepos?\195?\169s. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/LibUtils.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/LibUtils.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/LibUtils.java 2009-02-13 10:25:22 UTC (rev 4462) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/LibUtils.java 2009-02-13 13:30:34 UTC (rev 4463) @@ -27,7 +27,7 @@ /** * Quelques m\xE9thodes utiles et ind\xE9dendantes. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class LibUtils { @@ -70,7 +70,7 @@ } } CtuluCommandComposite cmd=new CtuluCommandComposite(); - // Pour chaque polyligne selectionn\xE9es + // Pour chaque point selectionn\xE9 GISPolyligne polyligne=(GISPolyligne)_zone.getGeometry(_idxGeom); List<Coordinate> newCoords=new ArrayList<Coordinate>(polyligne.getNumPoints()); for (int j=0; j<polyligne.getNumPoints(); j++) @@ -129,6 +129,7 @@ PointProj pointProj=new PointProj(); pointProj.c=cp; pointProj.indiceCurviligne=new GrVecteur(cp.x-pt1.x_, cp.y-pt1.y_, cp.z-pt1.z_).division(vecP1P2); + pointProj.indiceCurviligne=((double) ((long) (pointProj.indiceCurviligne*10000)))/10000.; if (pointProj.indiceCurviligne>=0&&pointProj.indiceCurviligne<=1) { for (int l=0; l<_zone.getNbAttributes(); l++) if (_zone.getAttribute(l).isAtomicValue()) Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java 2009-02-13 10:25:22 UTC (rev 4462) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java 2009-02-13 13:30:34 UTC (rev 4463) @@ -45,7 +45,7 @@ * demander \xE0 l'utilisateur certaines informations suppl\xE9mentaires. * * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class BiefImporterFromModels { @@ -110,8 +110,8 @@ } else if (k<profils_.getNombre()-1) { CoordinateSequence profilPrevious=zone.getCoordinateSequence(k+1); - Coordinate pointProfilPrevious=profilPrevious.getCoordinate(profilPrevious.size()/2); - vAxeH=new Coordinate(pointProfilPrevious.x-interAxeProfil.x, pointProfilPrevious.y-interAxeProfil.y, 0); + Coordinate pointProfilNext=profilPrevious.getCoordinate(profilPrevious.size()/2); + vAxeH=new Coordinate(pointProfilNext.x-interAxeProfil.x, pointProfilNext.y-interAxeProfil.y, 0); } else { if (axeHydraulique_.getNombre()>0) { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-13 10:25:22 UTC (rev 4462) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-13 13:30:34 UTC (rev 4463) @@ -246,10 +246,10 @@ if (seq.size()<2) throw new ProfilContainerException(FudaaLib.getS("Le profil doit avoir au minimum deux points.")); // Verifie que deux points cons\xE9cutifs ne sont pas confondus. \\ - for (int i=1; i<seq.size(); i++) +/* for (int i=1; i<seq.size(); i++) if (seq.getX(i-1)==seq.getX(i)&&seq.getY(i-1)==seq.getY(i)) throw new ProfilContainerException(FudaaLib.getS("Au moins deux points dans le profil sont confondus.")); - // Calcul des acbscisses curvilignes => hypoth\xE8se d'ordonnancement correcte des points \\ +*/ // Calcul des acbscisses curvilignes => hypoth\xE8se d'ordonnancement correcte des points \\ updateCacheCurv(); // Remplissage du cache Z \\ updateCacheZ(); @@ -264,7 +264,7 @@ // Aucun point d'intersectin avec les axes qui suivent int j=i; while(ok&&++j+1<seq.size()) - ok=!mainAxe.intersects(GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{seq.getCoordinate(j), seq.getCoordinate(j+1)})); + ok=(!mainAxe.intersects(GISGeometryFactory.INSTANCE.createLineString(new Coordinate[]{seq.getCoordinate(j), seq.getCoordinate(j+1)})))||seq.getCoordinate(j).equals(seq.getCoordinate(i)); // Traitement d'une \xE9ventuelle intersection if(!ok) throw new ProfilContainerException(FudaaLib.getS("Le profil se coupe lui m\xEAme. Il n'est donc pas valide.")); @@ -272,9 +272,27 @@ /// D\xE9termination des points de ruptures. \\\ idxRuptures_.clear(); - for (int i=1; i<seq.size()-1; i++) - if(UtilsProfil1d.getAngle(seq.getCoordinate(i-1), seq.getCoordinate(i), seq.getCoordinate(i+1))<_tolerance) - idxRuptures_.add(i); + int idx1=0; + int idx2=1; + int idx3=2; + while(idx3<seq.size()) { + if(idx1==idx2) + idx2++; + else if(idx2==idx3) + idx3++; + else if(seq.getCoordinate(idx1).equals(seq.getCoordinate(idx2))) + idx2++; + else if(seq.getCoordinate(idx2).equals(seq.getCoordinate(idx3))) + idx3++; + else { + if(UtilsProfil1d.getAngle(seq.getCoordinate(idx1), seq.getCoordinate(idx2), seq.getCoordinate(idx3))<_tolerance) + idxRuptures_.add(idx2); + if(idx2+1<idx3) + idx2++; + else + idx1=idx2; + } + } // Lin\xE9arisation du profil int[] idxRuptures=new int[idxRuptures_.size()+2]; idxRuptures[0]=0; @@ -648,12 +666,12 @@ // // Delta pour savoir si des doubles sont \xE9gaux // double tolerance=0.000001; - // Verifie que le point reste encadr\xE9 par le(s) m\xEAme(s) point(s) - if((_idxPoint==0&&_value>=curv_.get(1))||(_idxPoint==seq.size()-1&&_value<=curv_.get(seq.size()-2))||(_idxPoint!=0&&_idxPoint!=seq.size()-1&&(_value<=curv_.get(_idxPoint-1)||_value>=curv_.get(_idxPoint+1)))) - throw new ProfilContainerException(FudaaLib.getS("Il est interdit de d\xE9placer un point au dela des points l'encadrant.")); - // Cas o\xF9 l'index n'est pas sur un point de rupture \\ if (!idxRuptures_.contains(_idxPoint)) { + // Verifie que le point reste encadr\xE9 par le(s) m\xEAme(s) point(s) + if((_idxPoint==0&&_value>=curv_.get(1))||(_idxPoint==seq.size()-1&&_value<=curv_.get(seq.size()-2))||(_idxPoint!=0&&_idxPoint!=seq.size()-1&&(_value<=curv_.get(_idxPoint-1)||_value>=curv_.get(_idxPoint+1)))) + throw new ProfilContainerException(FudaaLib.getS("Il est interdit de d\xE9placer un point au dela des points l'encadrant.")); + // Le point reste encadr\xE9 par les deux m\xEAme points => le signe de xa-xb et // de ya-yb ne change pas Coordinate newCoord=UtilsProfil1d.getCoordinateXY(seq, _value); @@ -666,6 +684,8 @@ else curv_.set(_idxPoint, _value); } + else + throw new ProfilContainerException(FudaaLib.getS("Point de rupture non d\xE9pla\xE7able.")); // // Cas complexe : l'index est sur un point de rupture \\ // else { Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-02-13 10:25:22 UTC (rev 4462) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-02-13 13:30:34 UTC (rev 4463) @@ -194,6 +194,7 @@ // Abscisse curviligne du profil sur l'axe hydraulique tfAxeHydraulique_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { + controller_.clearError(); double oldValue=modelTable_.getAbsCurvProfilOnAxeHydraulique(); try { modelTable_.setAbsCurvProfilOnAxeHydraulique(Double.parseDouble(tfAxeHydraulique_.getText())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-02-13 10:25:25
|
Revision: 4462 http://fudaa.svn.sourceforge.net/fudaa/?rev=4462&view=rev Author: emmanuel_martin Date: 2009-02-13 10:25:22 +0000 (Fri, 13 Feb 2009) Log Message: ----------- Modeleur 1d : autoscroll pour le tableau de coordonn?\195?\169es et le tableau de profils. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionProfil.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionProfil.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionProfil.java 2009-02-12 22:54:12 UTC (rev 4461) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionProfil.java 2009-02-13 10:25:22 UTC (rev 4462) @@ -16,6 +16,7 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; +import javax.swing.event.ListSelectionEvent; import javax.swing.table.DefaultTableModel; import org.fudaa.ctulu.gui.CtuluTable; @@ -53,7 +54,16 @@ body.setLayout(new BuBorderLayout(2, 2)); add(body, BuBorderLayout.CENTER); // Tableau de noms - tableProfils_=new CtuluTable(new TableProfilModel()); + tableProfils_=new CtuluTable(new TableProfilModel()) { + /* (non-Javadoc) + * @see javax.swing.JTable#valueChanged(javax.swing.event.ListSelectionEvent) + */ + @Override + public void valueChanged(ListSelectionEvent e) { + super.valueChanged(e); + scrollRectToVisible(getCellRect(getSelectionModel().getMaxSelectionIndex(), 0, false)); + } + }; tableProfils_.setSelectionModel(controllerProfil_.getProfilSelectionModel()); body.add(new JScrollPane(tableProfils_), BuBorderLayout.CENTER); // Boutons Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-02-12 22:54:12 UTC (rev 4461) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-02-13 10:25:22 UTC (rev 4462) @@ -17,6 +17,7 @@ import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.SwingUtilities; +import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableModel; @@ -171,7 +172,16 @@ setLayout(new BuBorderLayout(2, 2)); // Tableau modelTable_=new TableGeomModel(_data, controller_.getFormater()); - table_=new CtuluTable(modelTable_); + table_=new CtuluTable(modelTable_) { + /* (non-Javadoc) + * @see javax.swing.JTable#valueChanged(javax.swing.event.ListSelectionEvent) + */ + @Override + public void valueChanged(ListSelectionEvent e) { + super.valueChanged(e); + scrollRectToVisible(getCellRect(getSelectionModel().getMaxSelectionIndex(), 0, false)); + } + }; table_.getColumnModel().getColumn(0).setCellRenderer(new DefaultTableCellRenderer(){ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { @@ -220,9 +230,10 @@ /** Selectionne les points dont les indices sont pass\xE9s en param\xE8tre. */ public void setSelection(int[] _idxSelection){ table_.getSelectionModel().clearSelection(); - if(_idxSelection!=null) + if(_idxSelection!=null) { for(int i=0;i<_idxSelection.length;i++) table_.getSelectionModel().addSelectionInterval(_idxSelection[i], _idxSelection[i]); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2009-02-12 22:54:15
|
Revision: 4461 http://fudaa.svn.sourceforge.net/fudaa/?rev=4461&view=rev Author: deniger Date: 2009-02-12 22:54:12 +0000 (Thu, 12 Feb 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/Thumbs.db branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.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/TrPostCommonImplementation.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceAbstract.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostSourceRubar.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/persist/TrPostPersistenceManager.java Removed Paths: ------------- branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/Thumbs.db Deleted: branches/Prepro-0.92-SNAPSHOT/ctulu/src/com/memoire/bu/Thumbs.db =================================================================== (Binary files differ) Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/calque/BVueCalque.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -487,13 +487,17 @@ * final GrBoite b = new GrBoite(new GrPoint(insets.left, insets.top, 0), new GrPoint(getWidth() - insets.left - * insets.right, getHeight() - insets.top - insets.bottom, 0)).; */ - final GrBoite b = new GrBoite(new GrPoint(0, getHeight(), 0), new GrPoint(getWidth(),0, 0)); + double minX = 0; + double minY = 0; + double maxX = getWidth(); + double maxY = getHeight(); if (insets_ != null) { - b.o_.x_ += insets_.left; - b.o_.y_ = b.o_.y_-(insets_.bottom+insets_.top); - b.e_.x_ =b.e_.x_- (insets_.left + insets_.right); - b.e_.y_ += insets_.top ; + minX = insets_.left; + minY = insets_.top; + maxX = maxX - insets_.right; + maxY = maxY - insets_.bottom; } + final GrBoite b = new GrBoite(new GrPoint(minX, minY, 0), new GrPoint(maxX, maxY, 0)); b.autoApplique(getCalque().getVersReel()); return b; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/commun/EbliModelInfos.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -1,7 +1,6 @@ package org.fudaa.ebli.commun; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.Map; @@ -29,19 +28,14 @@ * Les infos de la table. */ private Map<String, String> infos_; - private final Comparator<String> comparator_; +// private final Comparator<String> comparator_; public EbliModelInfos(List<String> liste, Map<String, String> map, List<String> colonnes) { - this(liste, map, colonnes, null); - } - - public EbliModelInfos(List<String> liste, Map<String, String> map, List<String> colonnes, - Comparator<String> comparator) { super(); listeKey_ = liste; infos_ = map; - comparator_ = comparator; +// comparator_ = comparator; colonnes_ = colonnes; listeValue_ = new ArrayList<String>(); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/Thumbs.db =================================================================== (Binary files differ) Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/ressource/ebli_en.fr_txt 2009-02-12 22:54:12 UTC (rev 4461) @@ -636,10 +636,17 @@ Conserver le ratio hauteur/largeur=Preserve width/height ratio Ne pas conserver le ratio hauteur/largeur=Do not preserve width/height ratio Dupliquer la sc\xE8ne= Duplicate the scene -Taille des pas= Step's lenght -Manuel: Nb graduations=Manual: nb of graduations -Manuel: taille des pas=Manual: Step's lenght +Nombre de graduations=Number of graduations +Longueur des pas=Step length +Manuel\: longueur des pas=Manual\: Step's length +Manuel\: Nombre de graduations=Manual\: Number of graduations +Automatique\: longueur des pas=Automatic\: Step's length +Automatique\: Nombre de graduations=Automatic\: Number of graduations Automatique=Automatic Grille auto activ\xE9e=Automatic Grid activated Couleur Grille=Grid's Color Couleur Sous Grille=SubGrid's color +Dessiner l'axe=Draw Axis +Dessiner les sous-graduations=Draw minor graduations +Grille\: trac\xE9 des lignes principales=Grid\:main lines +Grille\: lignes des sous graduations=Grid\:minor lines \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FilleVisuSaver.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -26,6 +26,7 @@ String name_; Dimension ifDim_; BCalqueSaverInterface props_; + BCalqueSaverInterface cqInfosProps_; String selectedLayer_; double ptMinX_; double ptMinY_; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/commun/save/FudaaFilleVisuPersistence.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -28,8 +28,8 @@ import com.memoire.fu.FuLog; /** - * Une classe pour la persistence d'une fenetre de visualisation 2D, qui contient des - * calques 2D. Les informations de la fenetre sont sauv\xE9es sur fichier projet .fzip. + * Une classe pour la persistence d'une fenetre de visualisation 2D, qui contient des calques 2D. Les informations de la + * fenetre sont sauv\xE9es sur fichier projet .fzip. * * @author fred deniger * @version $Id: FudaaFilleVisuPersistence.java,v 1.9.4.2 2008-04-01 07:20:52 bmarchan Exp $ @@ -90,7 +90,6 @@ // // } // } - public void saveIn(final CtuluArkSaver _writer, final ProgressionInterface _prog) { try { final BGroupeCalque donneesCalque = visu_.getDonneesCalque(); @@ -98,6 +97,7 @@ final BCalquePersistenceGroupe persistenceMng = donneesCalque.getGroupePersistenceMng(); persistenceMng.setTop(true); commitData(_writer.getDb(), persistenceMng.saveIn(donneesCalque, _writer, rep_ + '/', rep_), _prog); + } catch (final IOException _evt) { FuLog.error(_evt); @@ -112,6 +112,7 @@ private void commitData(final ObjectContainer _db, final BCalqueSaverInterface _data, final ProgressionInterface _prog) { final FilleVisuSaver saveData = setData(_db); saveData.props_ = _data; + saveData.cqInfosProps_ = visu_.getCqInfos().getGroupePersistenceMng().save(visu_.getCqInfos(), _prog); _db.set(saveData); _db.commit(); } @@ -136,7 +137,8 @@ saveData.ptMaxY_ = b.e_.y_; saveData.ptMinX_ = b.o_.x_; saveData.ptMinY_ = b.o_.y_; - saveData.legendUI_ = visu_.getCqLegend().saveUIProperties(); + + // saveData.legendUI_ = visu_.getCqLegend().saveUIProperties(); final BCalque selectedLayers = visu_.getCalqueActif(); if (selectedLayers != null) { saveData.selectedLayer_ = selectedLayers.getName(); @@ -146,6 +148,7 @@ /** * Restaure la fenetre de visu 2D : Les calques et les propri\xE9t\xE9s de la fenetre. + * * @param _impl L'implementation * @param _loader Le zip loader * @param _prog La progression de tache @@ -195,6 +198,7 @@ /** * Restaure les propri\xE9t\xE9s de la fenetre (hors calques de donn\xE9es). + * * @param _saveData Les propri\xE9t\xE9s de la fenetre de visu. * @param _impl L'implementation * @param _parent Le calque racine des calques de donn\xE9es. @@ -229,6 +233,10 @@ if (_saveData.legendUI_ != null && visu_.getCqLegend() != null) { visu_.getCqLegend().initFrom(_saveData.legendUI_); } + if (_saveData.cqInfosProps_ != null && visu_.getCqInfos() != null) { + visu_.getCqInfos().getGroupePersistenceMng().restore(_saveData.cqInfosProps_, visu_, + (BCalque) visu_.getCqInfos().getParent(), null); + } } }; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/sig/layer/FSigGrillePalette.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -1,16 +1,12 @@ package org.fudaa.fudaa.sig.layer; -import java.awt.BorderLayout; import java.awt.CardLayout; -import java.awt.Color; import java.awt.Container; -import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeListener; -import javax.swing.JColorChooser; import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; @@ -24,7 +20,6 @@ import org.fudaa.ebli.controle.BSelecteurReduitFonteNewVersion; import org.fudaa.ebli.controle.BSelecteurTargetInterface; import org.fudaa.ebli.ressource.EbliResource; -import org.fudaa.ebli.trace.TraceIconButton; import org.fudaa.ebli.trace.TraceLigneModel; import org.fudaa.ebli.volume.controles.BControleVisible; @@ -70,7 +65,6 @@ return r; } - public JComponent buildContentPane() { final BuPanel content = new BuPanel(new BuVerticalLayout(2)); content.add(createMainProperties()); @@ -79,11 +73,11 @@ return content; } - public static String GRILLE_AXE_X="GRILLE_AXE_X"; - public static String GRILLE_AXE_Y="GRILLE_AXE_Y"; - public static String SOUS_GRILLE_AXE_X="SOUS_GRILLE_AXE_X"; - public static String SOUS_GRILLE_AXE_Y="SOUS_GRILLE_AXE_Y"; - + public static String GRILLE_AXE_X = "GRILLE_AXE_X"; + public static String GRILLE_AXE_Y = "GRILLE_AXE_Y"; + public static String SOUS_GRILLE_AXE_X = "SOUS_GRILLE_AXE_X"; + public static String SOUS_GRILLE_AXE_Y = "SOUS_GRILLE_AXE_Y"; + private static String MANUEL1 = "MANUEL1"; private static String MANUEL2 = "MANUEL2"; private static String AUTO = "AUTO"; @@ -97,25 +91,22 @@ boolean modeAutomatiqueY_ = true; private BuPanel createAxis() { - final BuPanel panelX = new BuPanel(new FlowLayout(FlowLayout.LEFT)); - final BuPanel panelY = new BuPanel(new FlowLayout(FlowLayout.LEFT)); - final BuPanel panelSousGrilleeX = new BuPanel(new FlowLayout(FlowLayout.LEFT)); - final BuPanel panelSousGrilleeY = new BuPanel(new FlowLayout(FlowLayout.LEFT)); - final BuCheckBox cbsousGrilleX = new BuCheckBox(EbliLib.getS("Dessiner les sous graduations X")); - final BuCheckBox cbsousGrilleY = new BuCheckBox(EbliLib.getS("Dessiner les sous graduations Y")); - - panelX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Graduations X"))); - final BuComboBox combo = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nb graduations"), - EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nb graduations"), - EbliLib.getS("Automatique: longueur des pas") }); + final BuPanel panelX = new BuPanel(new BuGridLayout(3, 5, 5, true, false, true, true, true)); + final BuPanel panelY = new BuPanel(new BuGridLayout(3, 5, 5, true, false, true, true, true)); + String text = EbliLib.getS("Dessiner les sous-graduations"); + // final BuPanel panelSousGrilleeX = new BuPanel(new FlowLayout(FlowLayout.LEFT)); + // final BuPanel panelSousGrilleeY = new BuPanel(new FlowLayout(FlowLayout.LEFT)); + final BuCheckBox cbsousGrilleX = new BuCheckBox(text); + final BuCheckBox cbsousGrilleY = new BuCheckBox(text); + + panelX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axe X"))); + final BuComboBox combo = createAxeComboBox(); final CardLayout layoutCardX = new CardLayout(); - + final BuPanel panelCardX = new BuPanel(layoutCardX); // panelCardX.setLayout(layoutCardX); - - - final BuCheckBox cbX = new BuCheckBox(EbliLib.getS("Dessiner l'axe X")); + final BuCheckBox cbX = new BuCheckBox(EbliLib.getS("Dessiner l'axe")); cbX.setSelected(target_.isDrawX()); cbX.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -124,16 +115,14 @@ } }); - - BuPanel paneCombo1=new BuPanel(); - paneCombo1.add(combo); - panelX.add(cbX/*, BorderLayout.SOUTH*/); - panelX.add(paneCombo1/*, BorderLayout.NORTH*/); - panelX.add(panelCardX/*, BorderLayout.CENTER*/); - + + panelX.add(cbX/* , BorderLayout.SOUTH */); + panelX.add(combo/* , BorderLayout.NORTH */); + panelX.add(panelCardX/* , BorderLayout.CENTER */); + // -- panel x manuel 1: choix par nb de cesures --// final BuPanel pnXmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduations"))); + // pnXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduations"))); final BuTextField btGraduationX = BuTextField.createIntegerField(); btGraduationX.setColumns(5); btGraduationX.setValue(new Integer(target_.getNbXGraduations())); @@ -156,10 +145,10 @@ // -- panel x manuel 2: choix par longueur des pas --// final BuPanel pnXmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + // pnXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); final BuTextField btGraduationX2 = BuTextField.createDoubleField(); btGraduationX2.setColumns(5); - // btGraduationX2.setValue(new Integer(target_.get)); + // btGraduationX2.setValue(new Integer(target_.get)); pnXmanu2.add(btGraduationX2); btGraduationX2.addActionListener(new ActionListener() { @@ -179,75 +168,67 @@ // --on affiche le manuel 1 par defaut --// layoutCardX.show(panelCardX, "MANUEL1"); - combo.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - modeAutomatiqueX_ = false; - if (combo.getSelectedIndex() == 0){ - layoutCardX.show(panelCardX, MANUEL1); - final int newVal = ((Integer) btGraduationX.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setNbGraduationX(newVal); - } + public void actionPerformed(ActionEvent e) { + modeAutomatiqueX_ = false; + if (combo.getSelectedIndex() == 0) { + layoutCardX.show(panelCardX, MANUEL1); + final int newVal = ((Integer) btGraduationX.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationX(newVal); } - else if (combo.getSelectedIndex() == 1){ - layoutCardX.show(panelCardX, MANUEL2); - if(btGraduationX2.getValue()!=null){ - final double newVal = ((Double) btGraduationX2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setLenghtStepsX(newVal); - } - } - } - else if (combo.getSelectedIndex() == 2) { - layoutCardX.show(panelCardX, MANUEL1); - modeAutomatiqueX_ = true; - final int newVal = ((Integer) btGraduationX.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setNbGraduationX(newVal); + } else if (combo.getSelectedIndex() == 1) { + layoutCardX.show(panelCardX, MANUEL2); + if (btGraduationX2.getValue() != null) { + final double newVal = ((Double) btGraduationX2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsX(newVal); } - } else if (combo.getSelectedIndex() == 3) { - layoutCardX.show(panelCardX, MANUEL2); - modeAutomatiqueX_ = true; - if(btGraduationX2.getValue()!=null){ + } + } else if (combo.getSelectedIndex() == 2) { + layoutCardX.show(panelCardX, MANUEL1); + modeAutomatiqueX_ = true; + final int newVal = ((Integer) btGraduationX.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationX(newVal); + } + } else if (combo.getSelectedIndex() == 3) { + layoutCardX.show(panelCardX, MANUEL2); + modeAutomatiqueX_ = true; + if (btGraduationX2.getValue() != null) { final double newVal = ((Double) btGraduationX2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setLenghtStepsX(newVal); - }} + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsX(newVal); + } } - - if(combo.getSelectedIndex()>=2){ - cbsousGrilleX.setSelected(false); - cbsousGrilleX.setEnabled(false); - target_.setDrawSousGrilleX(false); - }else{ - cbsousGrilleX.setEnabled(true); - } - - - } - }); - - + if (combo.getSelectedIndex() >= 2) { + cbsousGrilleX.setSelected(false); + cbsousGrilleX.setEnabled(false); + target_.setDrawSousGrilleX(false); + } else { + cbsousGrilleX.setEnabled(true); + } + + } + + }); + // -- Panel y --// - - panelY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Graduations Y"))); - final BuComboBox comboY = new BuComboBox(new String[] { EbliLib.getS("Manuel: Nb graduations"), - EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nb graduations"), - EbliLib.getS("Automatique: longueur des pas") }); + + panelY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Axe Y"))); + final BuComboBox comboY = createAxeComboBox(); final CardLayout layoutCardY = new CardLayout(); - + final BuPanel panelCardY = new BuPanel(layoutCardY); // panelCardY.setLayout(layoutCardY); - - - final BuCheckBox cbY = new BuCheckBox(EbliLib.getS("Dessiner l'axe Y")); + + final BuCheckBox cbY = new BuCheckBox(EbliLib.getS("Dessiner l'axe")); cbY.setSelected(target_.isDrawY()); cbY.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -256,16 +237,15 @@ } }); - BuPanel combo3=new BuPanel(); - combo3.add(comboY); - panelY.add(cbY /*,BorderLayout.SOUTH*/); - panelY.add(combo3/*, BorderLayout.NORTH*/); - panelY.add(panelCardY/*, BorderLayout.CENTER*/); - + // BuPanel combo3 = new BuPanel(); + // combo3.add(comboY); + panelY.add(cbY /* ,BorderLayout.SOUTH */); + panelY.add(comboY/* , BorderLayout.NORTH */); + panelY.add(panelCardY/* , BorderLayout.CENTER */); // -- panel y manuel 1: choix par nb de cesures --// final BuPanel pnYmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + // pnYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); final BuTextField btGraduationY = BuTextField.createIntegerField(); btGraduationY.setColumns(5); btGraduationY.setValue(new Integer(target_.getNbYGraduations())); @@ -288,10 +268,10 @@ // -- panel y manuel 2: choix par longueur des pas --// final BuPanel pnYmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + // pnYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); final BuTextField btGraduationY2 = BuTextField.createDoubleField(); btGraduationY2.setColumns(5); - // btGraduationY2.setValue(new Integer(target_.getNbXGraduations())); + // btGraduationY2.setValue(new Integer(target_.getNbXGraduations())); pnYmanu2.add(btGraduationY2); btGraduationY2.addActionListener(new ActionListener() { @@ -310,91 +290,79 @@ // --on affiche le manuel 1 par defaut --// layoutCardY.show(panelCardY, "MANUEL1"); - comboY.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - modeAutomatiqueY_ = false; - if (comboY.getSelectedIndex() == 0){ - layoutCardY.show(panelCardY, MANUEL1); - final int newVal = ((Integer) btGraduationY.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setNbGraduationY(newVal); - } + public void actionPerformed(ActionEvent e) { + modeAutomatiqueY_ = false; + if (comboY.getSelectedIndex() == 0) { + layoutCardY.show(panelCardY, MANUEL1); + final int newVal = ((Integer) btGraduationY.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationY(newVal); } - else if (comboY.getSelectedIndex() == 1){ - layoutCardY.show(panelCardY, MANUEL2); - if(btGraduationY2.getValue()!=null){ - final double newVal = ((Double) btGraduationY2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setLenghtStepsY(newVal); - }} - } - else if (comboY.getSelectedIndex() == 2) { - layoutCardY.show(panelCardY, MANUEL1); - modeAutomatiqueY_ = true; - final int newVal = ((Integer) btGraduationY.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setNbGraduationY(newVal); - } - } else if (comboY.getSelectedIndex() == 3) { - layoutCardY.show(panelCardY, MANUEL2); - modeAutomatiqueY_ = true; - if(btGraduationY2.getValue()!=null){ + } else if (comboY.getSelectedIndex() == 1) { + layoutCardY.show(panelCardY, MANUEL2); + if (btGraduationY2.getValue() != null) { final double newVal = ((Double) btGraduationY2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setLenghtStepsY(newVal); - }} + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsY(newVal); + } } - - if(comboY.getSelectedIndex()>=2){ - cbsousGrilleY.setSelected(false); - cbsousGrilleY.setEnabled(false); - target_.setDrawSousGrilleY(false); - }else{ - cbsousGrilleY.setEnabled(true); + } else if (comboY.getSelectedIndex() == 2) { + layoutCardY.show(panelCardY, MANUEL1); + modeAutomatiqueY_ = true; + final int newVal = ((Integer) btGraduationY.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationY(newVal); + } + } else if (comboY.getSelectedIndex() == 3) { + layoutCardY.show(panelCardY, MANUEL2); + modeAutomatiqueY_ = true; + if (btGraduationY2.getValue() != null) { + final double newVal = ((Double) btGraduationY2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsY(newVal); } - + } } - }); - - - - - + if (comboY.getSelectedIndex() >= 2) { + cbsousGrilleY.setSelected(false); + cbsousGrilleY.setEnabled(false); + target_.setDrawSousGrilleY(false); + } else { + cbsousGrilleY.setEnabled(true); + } + + } + + }); // -- panel des sous grilles --// // --sous grille x --// - - - final BuComboBox comboSousGrilleX = new BuComboBox(new String[] { EbliLib.getS("Nb graduations"), + + final BuComboBox comboSousGrilleX = new BuComboBox(new String[] { EbliLib.getS("Nombre de graduations"), EbliLib.getS("Longueur des pas") }); - - + final CardLayout layoutCardSousGrilleX = new CardLayout(); final BuPanel panelCardSouGrilleX = new BuPanel(layoutCardSousGrilleX); - - + cbsousGrilleX.setSelected(target_.isDrawY()); - - - BuPanel combo2=new BuPanel(); - combo2.add(comboSousGrilleX); - panelSousGrilleeX.add(cbsousGrilleX/*, BorderLayout.SOUTH*/); - panelSousGrilleeX.add(combo2/*, BorderLayout.NORTH*/); - panelSousGrilleeX.add(panelCardSouGrilleX/*, BorderLayout.CENTER*/); - + + panelX.add(cbsousGrilleX/* , BorderLayout.SOUTH */); + panelX.add(comboSousGrilleX); + panelX.add(panelCardSouGrilleX/* , BorderLayout.CENTER */); + cbsousGrilleX.setSelected(false); // -- panel sous grille x manuel 1: choix par nb de cesures --// final BuPanel pnsousXmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - //pnsousXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + // pnsousXmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); final BuTextField btGraduationSousX = BuTextField.createIntegerField(); btGraduationSousX.setColumns(5); - btGraduationSousX.setValue(new Integer(target_.getNbXSousGraduations()-1)); + btGraduationSousX.setValue(new Integer(target_.getNbXSousGraduations() - 1)); pnsousXmanu1.add(btGraduationSousX); btGraduationSousX.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -410,7 +378,7 @@ panelCardSouGrilleX.add(pnsousXmanu1, MANUEL1); // -- panel sous grille x manuel 2: choix par longueur des pas --// final BuPanel pnSousXmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnSousXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + // pnSousXmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); final BuTextField btGraduationSousX2 = BuTextField.createDoubleField(); btGraduationSousX2.setColumns(5); // btGraduationSousX2.setValue(new Integer(target_.getNbXGraduations())); @@ -427,78 +395,73 @@ panelCardSouGrilleX.add(pnSousXmanu2, MANUEL2); cbsousGrilleX.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - target_.setModeAutomatiqueX(modeAutomatiqueX_); - if (comboSousGrilleX.getSelectedIndex() == 0){ - layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); - final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setNbGraduationSousGradX(newVal); - } + public void actionPerformed(final ActionEvent _e) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + if (comboSousGrilleX.getSelectedIndex() == 0) { + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); + final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationSousGradX(newVal); + } + } else if (comboSousGrilleX.getSelectedIndex() == 1) { + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); + if (btGraduationSousX2.getValue() != null) { + final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsSousGradX(newVal); } - else if (comboSousGrilleX.getSelectedIndex() == 1){ - layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); - if(btGraduationSousX2.getValue()!=null){ - final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setLenghtStepsSousGradX(newVal); - }} - } - - - target_.setDrawSousGrilleX(cbsousGrilleX.isSelected()); + } } - }); + + target_.setDrawSousGrilleX(cbsousGrilleX.isSelected()); + } + }); comboSousGrilleX.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (comboSousGrilleX.getSelectedIndex() == 0){ - layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); - final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setNbGraduationSousGradX(newVal); - } + public void actionPerformed(ActionEvent e) { + if (comboSousGrilleX.getSelectedIndex() == 0) { + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL1); + final int newVal = ((Integer) btGraduationSousX.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setNbGraduationSousGradX(newVal); } - else if (comboSousGrilleX.getSelectedIndex() == 1){ - layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); - if(btGraduationSousX2.getValue()!=null){ - final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueX(modeAutomatiqueX_); - target_.setLenghtStepsSousGradX(newVal); - }} + } else if (comboSousGrilleX.getSelectedIndex() == 1) { + layoutCardSousGrilleX.show(panelCardSouGrilleX, MANUEL2); + if (btGraduationSousX2.getValue() != null) { + final double newVal = ((Double) btGraduationSousX2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueX(modeAutomatiqueX_); + target_.setLenghtStepsSousGradX(newVal); + } } } - }); - - + } + }); + // --sous grille y --// - - final BuComboBox comboSousGrilleY = new BuComboBox(new String[] { EbliLib.getS("Nb graduations"), + + final BuComboBox comboSousGrilleY = new BuComboBox(new String[] { EbliLib.getS("Nombre de graduations"), EbliLib.getS("Longueur des pas") }); final CardLayout layoutCardSousGrilleY = new CardLayout(); - + final BuPanel panelCardSouGrilleY = new BuPanel(layoutCardSousGrilleY); // panelCardSouGrilleY.setLayout(layoutCardSousGrilleY); - - + cbsousGrilleY.setSelected(target_.isDrawY()); - - BuPanel combo4=new BuPanel(); - combo4.add(comboSousGrilleY); - panelSousGrilleeY.add(cbsousGrilleY/*, BorderLayout.SOUTH*/); - panelSousGrilleeY.add(combo4/*, BorderLayout.NORTH*/); - panelSousGrilleeY.add(panelCardSouGrilleY/*, BorderLayout.CENTER*/); - + + panelY.add(cbsousGrilleY/* , BorderLayout.SOUTH */); + panelY.add(comboSousGrilleY/* , BorderLayout.NORTH */); + panelY.add(panelCardSouGrilleY/* , BorderLayout.CENTER */); + cbsousGrilleY.setSelected(false); // -- panel sous grille x manuel 1: choix par nb de cesures --// final BuPanel pnsousYmanu1 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - // pnsousYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); + // pnsousYmanu1.add(new BuLabel(EbliLib.getS("Nombre de graduation"))); final BuTextField btGraduationSousY = BuTextField.createIntegerField(); btGraduationSousY.setColumns(5); - btGraduationSousY.setValue(new Integer(target_.getNbYSousGraduations()-1)); + btGraduationSousY.setValue(new Integer(target_.getNbYSousGraduations() - 1)); pnsousYmanu1.add(btGraduationSousY); btGraduationSousY.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent _e) { @@ -514,7 +477,7 @@ panelCardSouGrilleY.add(pnsousYmanu1, MANUEL1); // -- panel sous grille x manuel 2: choix par longueur des pas --// final BuPanel pnSousYmanu2 = new BuPanel(new BuGridLayout(2, 3, 3, false, false, false, false, false)); - //pnSousYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); + // pnSousYmanu2.add(new BuLabel(EbliLib.getS("Longueur des pas"))); final BuTextField btGraduationSousY2 = BuTextField.createDoubleField(); btGraduationSousY2.setColumns(5); // btGraduationSousY2.setValue(new Integer(target_.getNbYGraduations())); @@ -531,78 +494,69 @@ panelCardSouGrilleY.add(pnSousYmanu2, MANUEL2); cbsousGrilleY.addActionListener(new ActionListener() { - public void actionPerformed(final ActionEvent _e) { - target_.setModeAutomatiqueY(modeAutomatiqueY_); - if (comboSousGrilleY.getSelectedIndex() == 0){ - layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); - final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setNbGraduationSousGradY(newVal); - } + public void actionPerformed(final ActionEvent _e) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + if (comboSousGrilleY.getSelectedIndex() == 0) { + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); + final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationSousGradY(newVal); } - else if (comboSousGrilleY.getSelectedIndex() == 1){ - layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); - if(btGraduationSousY2.getValue()!=null){ - final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setLenghtStepsSousGradY(newVal); - }} + } else if (comboSousGrilleY.getSelectedIndex() == 1) { + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); + if (btGraduationSousY2.getValue() != null) { + final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsSousGradY(newVal); + } } - - target_.setDrawSousGrilleY(cbsousGrilleY.isSelected()); } - }); + + target_.setDrawSousGrilleY(cbsousGrilleY.isSelected()); + } + }); comboSousGrilleY.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (comboSousGrilleY.getSelectedIndex() == 0){ - layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); - final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setNbGraduationSousGradY(newVal); - } + public void actionPerformed(ActionEvent e) { + if (comboSousGrilleY.getSelectedIndex() == 0) { + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL1); + final int newVal = ((Integer) btGraduationSousY.getValue()).intValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setNbGraduationSousGradY(newVal); } - else if (comboSousGrilleY.getSelectedIndex() == 1){ - layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); - if(btGraduationSousY2.getValue()!=null){ - final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); - if(newVal>0){ - target_.setModeAutomatiqueY(modeAutomatiqueY_); - target_.setLenghtStepsSousGradY(newVal); - }} + } else if (comboSousGrilleY.getSelectedIndex() == 1) { + layoutCardSousGrilleY.show(panelCardSouGrilleY, MANUEL2); + if (btGraduationSousY2.getValue() != null) { + final double newVal = ((Double) btGraduationSousY2.getValue()).doubleValue(); + if (newVal > 0) { + target_.setModeAutomatiqueY(modeAutomatiqueY_); + target_.setLenghtStepsSousGradY(newVal); + } } } - }); - - - // -- init des panels grilles --// - BuPanel pnGrille = new BuPanel(new GridLayout(2, 1)); - pnGrille.add(panelX); - pnGrille.add(panelSousGrilleeX ); + } + }); - // -- init panel sous grilles --// - BuPanel pnSousGrille = new BuPanel(new GridLayout(2, 1)); - pnSousGrille.add(panelY); - pnSousGrille.add(panelSousGrilleeY); - panelSousGrilleeX.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Sous graduations X"))); - panelSousGrilleeY.setBorder(CtuluLibSwing.createTitleBorder(EbliLib.getS("Sous graduations Y"))); - // -- init au modes par defaut --// combo.setSelectedIndex(0); comboY.setSelectedIndex(0); // -- creation du panel contenant x et y --// BuPanel pnXY = new BuPanel(new GridLayout(2, 1)); - pnXY.add(pnGrille); - pnXY.add(pnSousGrille); + pnXY.add(panelX); + pnXY.add(panelY); return pnXY; } - - + private BuComboBox createAxeComboBox() { + return new BuComboBox(new String[] { EbliLib.getS("Manuel: Nombre de graduations"), + EbliLib.getS("Manuel: longueur des pas"), EbliLib.getS("Automatique: Nombre de graduations"), + EbliLib.getS("Automatique: longueur des pas") }); + } + private BuPanel createMainProperties() { final BuPanel pn = new BuPanel(); pn.setBorder(CtuluLibSwing.createTitleBorder(super.getTitle())); @@ -621,42 +575,17 @@ }); pn.add(cb); - pn.add(new BuLabel(EbliLib.getS("Forme Grille"))); -// final TraceIconButton btColor = new TraceIconButton(); -// btColor.setForeground(target_.getForeground()); -// btColor.addActionListener(new ActionListener() { -// -// public void actionPerformed(final ActionEvent _e) { -// final Color c = JColorChooser.showDialog(target_, EbliLib.getS("Couleur Grille"), target_.getForeground()); -// if (c != null) { -// target_.setForeground(c); -// btColor.setForeground(c); -// } -// } -// }); -// pn.add(btColor); - BSelecteurLineModel modelGraduations = new BSelecteurLineModel(GRILLE_AXE_X,this.target_.getTraceGraduations_()); - modelGraduations.setSelecteurTarget(this); - pn.add(modelGraduations.buildPanel()); - - pn.add(new BuLabel(EbliLib.getS("Forme Sous Grille"))); -// final TraceIconButton btColor2 = new TraceIconButton(); -// btColor2.setForeground(target_.getForeground()); -// btColor2.addActionListener(new ActionListener() { -// -// public void actionPerformed(final ActionEvent _e) { -// final Color c = JColorChooser.showDialog(target_, EbliLib.getS("Couleur Sous Grille"), target_.getForeground()); -// if (c != null) { -// target_.setSousGraduationColor(c); -// btColor2.setForeground(c); -// } -// } -// }); -// pn.add(btColor2); - BSelecteurLineModel modelSousGraduations = new BSelecteurLineModel(SOUS_GRILLE_AXE_X,this.target_.getTraceSousGraduations_()); - modelSousGraduations.setSelecteurTarget(this); - pn.add(modelSousGraduations.buildPanel()); - + pn.add(new BuLabel(EbliLib.getS("Grille: trac\xE9 des lignes principales"))); + BSelecteurLineModel modelGraduations = new BSelecteurLineModel(GRILLE_AXE_X, this.target_.getTraceGraduations_()); + modelGraduations.setSelecteurTarget(this); + pn.add(modelGraduations.buildPanel()); + + pn.add(new BuLabel(EbliLib.getS("Grille: lignes des sous graduations"))); + BSelecteurLineModel modelSousGraduations = new BSelecteurLineModel(SOUS_GRILLE_AXE_X, this.target_ + .getTraceSousGraduations_()); + modelSousGraduations.setSelecteurTarget(this); + pn.add(modelSousGraduations.buildPanel()); + pn.add(new BuLabel(EbliLib.getS("Fonte"))); final BuButton btFont = new BuButton("1234.567"); pn.add(btFont); @@ -724,50 +653,42 @@ return zoom; } + public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { + // TODO Auto-generated method stub -public void addPropertyChangeListener(String _key, PropertyChangeListener _l) { - // TODO Auto-generated method stub - -} + } + public Object getMin(String _key) { + // TODO Auto-generated method stub + return null; + } -public Object getMin(String _key) { - // TODO Auto-generated method stub - return null; -} + public Object getMoy(String _key) { + // TODO Auto-generated method stub + return null; + } + public Object getProperty(String _key) { + if (_key.equals(GRILLE_AXE_X)) return target_.getTraceGraduations_(); + if (_key.equals(SOUS_GRILLE_AXE_X)) return target_.getTraceSousGraduations_(); + return null; + } -public Object getMoy(String _key) { - // TODO Auto-generated method stub - return null; -} + public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { + // TODO Auto-generated method stub + } -public Object getProperty(String _key) { - if(_key.equals(GRILLE_AXE_X)) - return target_.getTraceGraduations_(); - if(_key.equals(SOUS_GRILLE_AXE_X)) - return target_.getTraceSousGraduations_(); - return null; -} - - -public void removePropertyChangeListener(String _key, PropertyChangeListener _l) { - // TODO Auto-generated method stub - -} - - -public boolean setProperty(String _key, Object prop) { - boolean ok=false; - if(_key.equals(GRILLE_AXE_X)){ - target_.modifieTraceGraduations((TraceLigneModel) prop); - ok=true; - } - if(_key.equals(SOUS_GRILLE_AXE_X)){ - target_.modifieSousGraduations((TraceLigneModel) prop); - ok=true; - } - return ok; -} + public boolean setProperty(String _key, Object prop) { + boolean ok = false; + if (_key.equals(GRILLE_AXE_X)) { + target_.modifieTraceGraduations((TraceLigneModel) prop); + ok = true; + } + if (_key.equals(SOUS_GRILLE_AXE_X)) { + target_.modifieSousGraduations((TraceLigneModel) prop); + ok = true; + } + return ok; + } } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -140,8 +140,8 @@ infoSoft = new BuInformationsSoftware(); infoSoft.name = "prepro"; - infoSoft.version = "0.93-MAQUETTE-V8"; - infoSoft.date = "2009-02-02"; + infoSoft.version = "0.94-MAQUETTE-V9"; + infoSoft.date = "2009-02-12"; infoSoft.rights = TrResource.getS("Tous droits r\xE9serv\xE9s") + ". CETMEF (c)2003-2007"; infoSoft.contact = "fre...@fu..."; infoSoft.license = "GPL2"; Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/tr_en.fr_txt =================================================================== (Binary files differ) Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-02-12 20:39:45 UTC (rev 4460) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCommonImplementation.java 2009-02-12 22:54:12 UTC (rev 4461) @@ -41,380 +41,375 @@ */ public abstract class TrPostCommonImplementation extends TrCommonImplementation { - TrPostProjet c_; + TrPostProjet c_; - public final TrPostProjet getCurrentProject() { - return c_; - } - public final void setCurrentProject(TrPostProjet _c) { - c_=_c; - } + public final TrPostProjet getCurrentProject() { + return c_; + } - /** - * @return toutes les fenetres de PostLayout - */ - public List<TrPostLayoutFille> getAllLayoutFille() { - final JInternalFrame[] allInternalFrames = getAllInternalFrames(); - if (allInternalFrames == null) return Collections.emptyList(); - final List<TrPostLayoutFille> res = new ArrayList<TrPostLayoutFille>(allInternalFrames.length); - for (int i = 0; i < allInternalFrames.length; i++) { - final JInternalFrame internalFrame = allInternalFrames[i]; - if (internalFrame instanceof TrPostLayoutFille) { - res.add((TrPostLayoutFille) internalFrame); - } - } - return res; - } + public final void setCurrentProject(TrPostProjet _c) { + c_ = _c; + } + /** + * @return toutes les fenetres de PostLayout + */ + public List<TrPostLayoutFille> getAllLayoutFille() { + final JInternalFrame[] allInternalFrames = getAllInternalFrames(); + if (allInternalFrames == null) return Collections.emptyList(); + final List<TrPostLayoutFille> res = new ArrayList<TrPostLayoutFille>(allInternalFrames.length); + for (int i = 0; i < allInternalFrames.length; i++) { + final JInternalFrame internalFrame = allInternalFrames[i]; + if (internalFrame instanceof TrPostLayoutFille) { + res.add((TrPostLayoutFille) internalFrame); + } + } + return res; + } - public void elimineDoublonNomsLayout(){ - List<TrPostLayoutFille> liste=getAllLayoutFille(); + public void elimineDoublonNomsLayout() { + List<TrPostLayoutFille> liste = getAllLayoutFille(); - for(int i=0;i<liste.size();i++){ - int cpt=1; - for(int j=i; j<liste.size();j++){ - if(liste.get(j).previousTitleFrame.equals(liste.get(i).previousTitleFrame)){ + for (int i = 0; i < liste.size(); i++) { + int cpt = 1; + for (int j = i; j < liste.size(); j++) { + if (liste.get(j).previousTitleFrame.equals(liste.get(i).previousTitleFrame)) { - liste.get(j).previousTitleFrame+="_"+(cpt++); - } - } + liste.get(j).previousTitleFrame += "_" + (cpt++); + } + } - } + } - } + } - /** - * @return la fenetre layout active. - */ - public TrPostLayoutFille getCurrentLayoutFille() { - final JInternalFrame currentInternalFrame = getCurrentInternalFrame(); - if( currentInternalFrame instanceof TrPostLayoutFille) - return (TrPostLayoutFille) currentInternalFrame; - else{ - //-- on recherche la premiere file layout qu'on a et on l'envoie --// - //-- ACHTUNG: CAS A TRAITER:EXEMPLE SI ON EST DANS LA FRAME GESTION MULTI SOURCE; ON EST PAS DANS LA CURRENT LAYOUT MAIS ON S EN FOUT--// - return getAllLayoutFille().get(0); - } - } + /** + * @return la fenetre layout active. + */ + public TrPostLayoutFille getCurrentLayoutFille() { + final JInternalFrame currentInternalFrame = getCurrentInternalFrame(); + if (currentInternalFrame instanceof TrPostLayoutFille) return (TrPostLayoutFille) currentInternalFrame; + else { + // -- on recherche la premiere file layout qu'on a et on l'envoie --// + // -- ACHTUNG: CAS A TRAITER:EXEMPLE SI ON EST DANS LA FRAME GESTION MULTI SOURCE; ON EST PAS DANS LA CURRENT + // LAYOUT MAIS ON S EN FOUT--// + return getAllLayoutFille().get(0); + } + } - /** - * @return la fenetre layout active ou la premiere des LayoutFille de cette application - */ - public TrPostLayoutFille getCurrentLayoutFilleOrFirst() { - TrPostLayoutFille current = getCurrentLayoutFille(); - if (current == null) { - final List<TrPostLayoutFille> allLayoutFille = getAllLayoutFille(); - if (!allLayoutFille.isEmpty()) current = allLayoutFille.get(0); - } - return current; - } + /** + * @return la fenetre layout active ou la premiere des LayoutFille de cette application + */ + public TrPostLayoutFille getCurrentLayoutFilleOrFirst() { + TrPostLayoutFille current = getCurrentLayoutFille(); + if (current == null) { + final List<TrPostLayoutFille> allLayoutFille = getAllLayoutFille(); + if (!allLayoutFille.isEmpty()) current = allLayoutFille.get(0); + } + return current; + } - @Override - public void init() { - super.init(); - final BuMenu menu = (BuMenu) getMainMenuBar().getMenu("IMPORTER"); - menu.addMenuItem(TrResource.getS("Autres r\xE9sultats"), getImportResultsAct()); - } + @Override + public void init() { + super.init(); + final BuMenu menu = (BuMenu) getMainMenuBar().getMenu("IMPORTER"); + menu.addMenuItem(TrResource.getS("Autres r\xE9sultats"), getImportResultsAct()); + } - String getImportResultsAct() { - return "IMPORT_RESULTS"; - } + String getImportResultsAct() { + return "IMPORT_RESULTS"; + } - @Override - public void close() { - if (c_ != null) { - c_.close(); - } - removeInternalFrames(getAllInternalFrames()); - } + @Override + public void close() { + if (c_ != null) { + c_.close(); + } + removeInternalFrames(getAllInternalFrames()); + } - public void setProjet(final TrPostProjet _c) { - if (c_ == _c) { return; } - new CtuluTaskOperationGUI(null, CtuluLibString.EMPTY_STRING) { + public void setProjet(final TrPostProjet _c) { + if (c_ == _c) { return; } + new CtuluTaskOperationGUI(null, CtuluLibString.EMPTY_STRING) { - @Override - public void act() { - saveAndCloseProjet(createProgressionInterface(this)); - c_ = _c; - if (c_ != null) { - c_.active(TrPostCommonImplementation.this); - BuLib.invokeNowOrLater(new Runnable() { - public void run() { - setEnabledForAction("CREER", true); - setEnabledForAction("ENREGISTRER", true); - setEnabledForAction("ENREGISTRERSOUS", true); - setEnabledForAction("IMPORTER", true); - setEnabledForAction("RECHERCHER", true); - setEnabledForAction(getImportResultsAct(), true); - setEnabledForAction("IMPORT_PROJECT", true); - } - }); - } - } - }.start(); + @Override + public void act() { + saveAndCloseProjet(createProgressionInterface(this)); + c_ = _c; + if (c_ != null) { + c_.active(TrPostCommonImplementation.this); + BuLib.invokeNowOrLater(new Runnable() { + public void run() { + setEnabledForAction("CREER", true); + setEnabledForAction("ENREGISTRER", true); + setEnabledForAction("ENREGISTRERSOUS", true); + setEnabledForAction("IMPORTER", true); + setEnabledForAction("RECHERCHER", true); + setEnabledForAction(getImportResultsAct(), true); + setEnabledForAction("IMPORT_PROJECT", true); + } + }); + } + } + }.start(); - } + } - public boolean saveAndCloseProjet(final ProgressionInterface _interface) { - if (c_ != null) { + public boolean saveAndCloseProjet(final ProgressionInterface _interface) { + if (c_ != null) { - // -- enregistrement sauce widget --// - final int i = CtuluLibDialog.confirmExitIfProjectisModified(getFrame()); - if (i == JOptionPane.CANCEL_OPTION) { - return false; - } - if (i != JOptionPane.NO_OPTION) { - c_.getManager().saveProject(false); - //c_.save(this, _interface); - } + // -- enregistrement sauce widget --// + if (c_.isModified()) { + final int i = CtuluLibDialog.confirmExitIfProjectisModified(getFrame()); + if (i == JOptionPane.CANCEL_OPTION) { return false; } + if (i != JOptionPane.NO_OPTION) { + c_.getManager().saveProject(false); + // c_.save(this, _interface); + } + } + c_.close(); + c_ = null; + SwingUtilities.invokeLater(new Runnable() { - c_.close(); - c_ = null; - SwingUtilities.invokeLater(new Runnable() { + public void run() { + setEnabledForAction("CREER", true); + setEnabledForAction("ENREGISTRER", false); + setEnabledForAction("IMPORTER", false); + setEnabledForAction(getImportResultsAct(), false); + setEnabledForAction("IMPORT_PROJECT", false); + } + }); + } - public void run() { - setEnabledForAction("CREER", true); - setEnabledForAction("ENREGISTRER", false); - setEnabledForAction("IMPORTER", false); - setEnabledForAction(getImportResultsAct(), false); - setEnabledForAction("IMPORT_PROJECT", false); - } - }); - } + return true; + } + @Override + public boolean confirmExit() { + final boolean b = super.confirmExit(); + if (b && c_ != null && !saveAndCloseProjet(null)) { return false; } + return b; + } + @Override + public void actionPerformed(final ActionEvent _evt) { + final String com = _evt.getActionCommand(); - return true; - } + if ("CREER".equals(com)) { - @Override - public boolean confirmExit() { - final boolean b = super.confirmExit(); - if (b && c_ != null && !saveAndCloseProjet(null)) { return false; } - return b; - } + if (c_ != null) { + final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(), TrResource + .getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); + if (reponse == JOptionPane.CANCEL_OPTION) { return; } + if (reponse == JOptionPane.OK_OPTION) { + c_.getManager().saveProject(false); + } + // -- nettoyage du projet pr\xE9c\xE9dent --// - @Override - public void actionPerformed(final ActionEvent _evt) { - final String com = _evt.getActionCommand(); + c_.getManager().clearProject(); + } else { + c_ = new TrPostProjet(this); + c_.setMenuPost(); + } + // -- ouverture d'un fichier r\xE9sultat qui sera automatiquement ajout\xE9 dans la layout courante --// + c_.createNewLayoutFrame(); + // -- ouverture d'un fichier r\xE9sultat --// + TrPostActionChooseAndCreateCalque chooserSource = new TrPostActionChooseAndCreateCalque(c_, c_.getImpl() + .getCurrentLayoutFille().controller_); + chooserSource.actionPerformed(null); - if ("CREER".equals(com)) { + } else if ("OUVRIR".equals(com)) { + // -- ouverture d un nouveau projet --// + if (c_ != null) { + final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(), TrResource + .getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); + if (reponse == JOptionPane.CANCEL_OPTION) { return; } + if (reponse == JOptionPane.OK_OPTION) { + c_.getManager().saveProject(false); + } - if(c_!=null){ - final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); - if (reponse == JOptionPane.CANCEL_OPTION) { return; } - if (reponse == JOptionPane.OK_OPTION) { - c_.getManager().saveProject(false); - } - //-- nettoyage du projet pr\xE9c\xE9dent --// + // -- nettoyage du projet pr\xE9c\xE9dent --// + c_.getManager().clearProject(); + } else { + c_ = new TrPostProjet(this); + c_.setMenuPost(); + } - c_.getManager().clearProject(); - } - else { - c_=new TrPostProjet(this); - c_.setMenuPost(); - } - //-- ouverture d'un fichier r\xE9sultat qui sera automatiquement ajout\xE9 dans la layout courante --// - c_.createNewLayoutFrame(); - //-- ouverture d'un fichier r\xE9sultat --// - TrPostActionChooseAndCreateCalque chooserSource= new TrPostActionChooseAndCreateCalque(c_,c_.getImpl().getCurrentLayoutFille().controller_); - chooserSource.actionPerformed(null); + c_.getManager().loadProject(false, null); + // new TrPostFusionProjet(c_); + } else + if ("FERMER".equals(com)) { + new CtuluTaskOperationGUI(this, TrResource.getS("Fermer")) { - }else - if ("OUVRIR".equals(com)) { - // -- ouverture d un nouveau projet --// - if(c_!=null){ - final int reponse = JOptionPane.showConfirmDialog(this.getParentComponent(),TrResource.getS("Le projet courant va \xEAtre ferm\xE9. \n Voulez vous sauvegarder le projet courant avant sa fermeture?")); - if (reponse == JOptionPane.CANCEL_OPTION) { return; } - if (reponse == JOptionPane.OK_OPTION) { - c_.getManager().saveProject(false); - } + @Override + public void act() { + saveAndCloseProjet(createProgressionInterface(this)); + } + }.start(); + } else if ("ENREGISTRER".equals(com) && c_ != null) { + new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement")) { - //-- nettoyage du projet pr\xE9c\xE9dent --// - c_.getManager().clearProject(); - }else - { - c_=new TrPostProjet(this); - c_.setMenuPost(); - } + @Override + public void act() { + // c_.save(TrPostCommonImplementation.this, createProgressionInterface(this)); - c_.getManager().loadProject(false, null); - //new TrPostFusionProjet(c_); + // -- enregistrement sauce widget --// + c_.getManager().saveProject(false); - } else + } + }.start(); + } else if ("ENREGISTRERSOUS".equals(com) && c_ != null) { + new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement Sous")) { - if ("FERMER".equals(com)) { - new CtuluTaskOperationGUI(this, TrResource.getS("Fermer")) { + @Override + public void act() { + // c_.save(TrPostCommonImplementation.this, createProgressionInterface(this)); - @Override - public void act() { - saveAndCloseProjet(createProgressionInterface(this)); - } - }.start(); - } else if ("ENREGISTRER".equals(com) && c_ != null) { - new CtuluTaskOperationGUI(this, TrResource.getS("Enregistrement")) { + // -- enregistrement sauce widget --// + c_.getManager().savePr... [truncated message content] |
From: <had...@us...> - 2009-02-12 20:39:51
|
Revision: 4460 http://fudaa.svn.sourceforge.net/fudaa/?rev=4460&view=rev Author: hadouxad Date: 2009-02-12 20:39:45 +0000 (Thu, 12 Feb 2009) Log Message: ----------- blindage lot 3 debut lot 4 Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLauncher.java branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeHorizontalPersist.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -4,6 +4,7 @@ import java.awt.Font; import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; /** @@ -21,7 +22,33 @@ TraceLigne grille; boolean isIteratorUptodate; Color lineColor; - + + /** + * Booleen qui indique si l'on trace ou non la graduation + */ + boolean traceGrille_=false; + + /** + * Booleen qui indique si l'on trcae + */ + boolean traceSousGrille_=false; + + TraceLigneModel traceGraduations_=null; + TraceLigneModel traceSousGraduations_=null; + /** + * Mode nb graduations + */ + int nbPas_; + + /** + * Mode on donne la longueur des pas + */ + double longueurPas_; + /** + * le mode de graduation + */ + int modeGraduations_; + public EGAxeHorizontalPersist(EGAxeHorizontal axeX) { // TODO Auto-generated constructor stub fillInfoWith(axeX); @@ -38,6 +65,15 @@ this.isIteratorUptodate = axeX.isIteratorUptodate_; this.lineColor = axeX.lineColor_; + //-- persistance grilles et sous grilles --// + traceGrille_=axeX.traceGrille_; + traceSousGrille_=axeX.traceSousGrille_; + traceGraduations_=axeX.traceGraduations_; + traceSousGraduations_=axeX.traceSousGraduations_; + nbPas_=axeX.nbPas_; + longueurPas_=axeX.longueurPas_; + modeGraduations_=axeX.modeGraduations_; + } public EGAxeHorizontal generateAxe(){ @@ -51,6 +87,15 @@ axeX.grille_ = this.grille; axeX.isIteratorUptodate_ = this.isIteratorUptodate; axeX.lineColor_ = this.lineColor; + + //-- persistance grilles et sous grilles --// + axeX.traceGrille_=traceGrille_; + axeX.traceSousGrille_=traceSousGrille_; + axeX.traceGraduations_=traceGraduations_; + axeX.traceSousGraduations_=traceSousGraduations_; + axeX.nbPas_=nbPas_; + axeX.longueurPas_=longueurPas_; + axeX.modeGraduations_=modeGraduations_; return axeX; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeRepereConfigurator.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -78,7 +78,11 @@ private CtuluValueEditorI editorV_; private JComponent tfHorMax_; private JComponent tfHorMin_; + private BuTextField tfHorPas_; + + + private JComponent tfVertMax_; private JComponent tfVertMin_; private BuTextField tfVertPas_; @@ -202,26 +206,58 @@ public void actionPerformed(ActionEvent e) { modeGraduationY_=combo.getSelectedIndex(); graphe_.axeUpdated(); + + EGAxe axeChoisi=null; + if(graphe_.getSelectedComponent()!=null) + axeChoisi=graphe_.getSelectedComponent().getAxeY(); + if(axeChoisi==null && axes_!=null && axes_.length>0) + axeChoisi=axes_[0]; + if(axeChoisi!=null) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + tfVertPas_.setText(""+axeChoisi.nbPas_); + else + if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + tfVertPas_.setText(""+axeChoisi.longueurPas_); + } }); + + EGAxe axeChoisi=null; + if(graphe_.getSelectedComponent()!=null) + axeChoisi=graphe_.getSelectedComponent().getAxeY(); + if(axeChoisi==null && axes_!=null && axes_.length>0) + axeChoisi=axes_[0]; + + if(axeChoisi!=null) + if(axeChoisi.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + tfVertPas_.setText(""+axeChoisi.nbPas_); + else + if(axeChoisi.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + tfVertPas_.setText(""+axeChoisi.longueurPas_); + + //-- affichage ou non des checkbox --// - - boxAfficheGraduationsY_.setSelected(false); + if(axeChoisi!=null) + boxAfficheGraduationsY_.setSelected(axeChoisi.traceGrille_); boxAfficheGraduationsY_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { apply(); } }); - boxAfficheSousGraduationsY_.setSelected(false); + if(axeChoisi!=null) + boxAfficheSousGraduationsY_.setSelected(axeChoisi.traceSousGrille_); boxAfficheSousGraduationsY_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { apply(); } }); + if(axeChoisi!=null) + modelGraduationsY_ = new BSelecteurLineModel(GRILLE_AXE_Y,axeChoisi.traceGraduations_); + else modelGraduationsY_ = new BSelecteurLineModel(GRILLE_AXE_Y); modelGraduationsY_.setSelecteurTarget(this); pnAxeV_.add(boxAfficheGraduationsY_); @@ -229,7 +265,11 @@ pnAxeV_.add(modelGraduationsY_.buildPanel()); //-- sous graduations --// - modelSousGraduationsY_ = new BSelecteurLineModel(SOUS_GRILLE_AXE_Y); + if(axeChoisi!=null) + modelSousGraduationsY_ = new BSelecteurLineModel(SOUS_GRILLE_AXE_Y,axeChoisi.traceSousGraduations_); + else + modelSousGraduationsY_ = new BSelecteurLineModel(SOUS_GRILLE_AXE_Y); + modelSousGraduationsY_.setSelecteurTarget(this); pnAxeV_.add(boxAfficheSousGraduationsY_); pnAxeV_.add(modelSousGraduationsY_.buildPanel()); @@ -293,6 +333,10 @@ public static String SOUS_GRILLE_AXE_X="SOUS_GRILLE_AXE_X"; public static String SOUS_GRILLE_AXE_Y="SOUS_GRILLE_AXE_Y"; + + BuComboBox comboHorizontal_=null; + BuComboBox comboVertical_=null; + private void buildHPanel(final boolean _removeAll) { final String minTxt = EbliLib.getS("Min:"); @@ -319,8 +363,17 @@ tfHorPas_.setColumns(10); tfHorPas_.setToolTipText(tooltipPas); tfHorPas_.addKeyListener(this); + + if(axeH_.modeGraduations_==EGAxe.AUTO_GRADUATIONS) + tfHorPas_.setText(""+axeH_.nbPas_); + else + if(axeH_.modeGraduations_==EGAxe.AUTO_LONGUEURPAS) + tfHorPas_.setText(""+axeH_.longueurPas_); } + + + tfHorMax_.addKeyListener(this); tfHorMin_.addKeyListener(this); @@ -337,32 +390,40 @@ // pas //-- selection du type de graduations - final BuComboBox combo = new BuComboBox(new String[] { /*EbliLib.getS("Manuel: Nb graduations"), + if(comboHorizontal_==null){ + comboHorizontal_= new BuComboBox(new String[] { /*EbliLib.getS("Manuel: Nb graduations"), EbliLib.getS("Manuel: longueur des pas"),*/ EbliLib.getS(/*"Automatique:*/" Nb graduations"), EbliLib.getS(/*"Automatique:*/" Longueur des pas") }); lb = new BuLabel(typePasTxt); //pnAxeH_.add(lb); - pnAxeH_.add(combo); - - //-- listener de la combo --// - combo.addActionListener(new ActionListener() { + //-- listener de la combo --// + comboHorizontal_.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - modeGraduationX_=combo.getSelectedIndex(); + modeGraduationX_=comboHorizontal_.getSelectedIndex(); + + if(modeGraduationX_==EGAxe.AUTO_GRADUATIONS) + tfHorPas_.setText(""+axeH_.nbPas_); + else + if(modeGraduationX_==EGAxe.AUTO_LONGUEURPAS) + tfHorPas_.setText(""+axeH_.longueurPas_); + graphe_.axeUpdated(); } }); - + } + + pnAxeH_.add(comboHorizontal_); //-- affichage ou non des checkbox --// - boxAfficheGraduationsX_.setSelected(false); + boxAfficheGraduationsX_.setSelected(axeH_.traceGrille_); boxAfficheGraduationsX_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { apply(); } }); - boxAfficheSousGraduationsX_.setSelected(false); + boxAfficheSousGraduationsX_.setSelected(axeH_.traceSousGrille_); boxAfficheSousGraduationsX_.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { @@ -760,12 +821,21 @@ return axeH_.traceGraduations_; if(_key.equals(SOUS_GRILLE_AXE_X)) return axeH_.traceSousGraduations_; - if(axes_==null || axes_.length==0) + + + EGAxe axeChoisi=null; + if(graphe_.getSelectedComponent()!=null) + axeChoisi=graphe_.getSelectedComponent().getAxeY(); + if(axeChoisi==null && axes_!=null && axes_.length>0) + axeChoisi=axes_[0]; + + if(axeChoisi==null) + //if(axes_==null || axes_.length==0) return null; if(_key.equals(GRILLE_AXE_Y)) - return axes_[0].traceGraduations_; + return axeChoisi.traceGraduations_; if(_key.equals(SOUS_GRILLE_AXE_Y)) - return axes_[0].traceSousGraduations_; + return axeChoisi.traceSousGraduations_; return null; @@ -783,7 +853,7 @@ ok=true; } if(ok) - apply(); + graphe_.axeUpdated(); if(axes_==null || axes_.length==0) return false; @@ -798,7 +868,7 @@ ok=true; } if(ok) - apply(); + graphe_.axeUpdated(); return false; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGAxeVerticalPersist.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -4,6 +4,7 @@ import java.awt.Font; import org.fudaa.ebli.trace.TraceLigne; +import org.fudaa.ebli.trace.TraceLigneModel; /** @@ -25,7 +26,31 @@ boolean isIteratorUptodate; Color lineColor; - + /** + * Booleen qui indique si l'on trace ou non la graduation + */ + boolean traceGrille_=false; + + /** + * Booleen qui indique si l'on trcae + */ + boolean traceSousGrille_=false; + + TraceLigneModel traceGraduations_=null; + TraceLigneModel traceSousGraduations_=null; + /** + * Mode nb graduations + */ + int nbPas_; + + /** + * Mode on donne la longueur des pas + */ + double longueurPas_; + /** + * le mode de graduation + */ + int modeGraduations_; public EGAxeVerticalPersist(EGAxeVertical axeY) { // TODO Auto-generated constructor stub @@ -45,6 +70,15 @@ this.grille = axeY.grille_; this.isIteratorUptodate = axeY.isIteratorUptodate_; this.lineColor = axeY.lineColor_; + + //-- persistance grilles et sous grilles --// + traceGrille_=axeY.traceGrille_; + traceSousGrille_=axeY.traceSousGrille_; + traceGraduations_=axeY.traceGraduations_; + traceSousGraduations_=axeY.traceSousGraduations_; + nbPas_=axeY.nbPas_; + longueurPas_=axeY.longueurPas_; + modeGraduations_=axeY.modeGraduations_; } @@ -63,6 +97,16 @@ axeY.grille_ = this.grille; axeY.isIteratorUptodate_ = this.isIteratorUptodate; axeY.lineColor_ = this.lineColor; + + //-- persistance grilles et sous grilles --// + axeY.traceGrille_=traceGrille_; + axeY.traceSousGrille_=traceSousGrille_; + axeY.traceGraduations_=traceGraduations_; + axeY.traceSousGraduations_=traceSousGraduations_; + axeY.nbPas_=nbPas_; + axeY.longueurPas_=longueurPas_; + axeY.modeGraduations_=modeGraduations_; + return axeY; } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbePersist.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -111,7 +111,7 @@ //-- donnees specifiques --// infos.put("GROUPE", groupe); - + infos.put("DEFAULTY", ordonnees); model.setPersistSpecificDatas(dataSpecifiques, infos); EGCourbeChild courbe=null; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphePersist.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -286,7 +286,15 @@ //-- on finalise les actions d'un graphe --// + try{ model.finalizePersistance(); + }catch(Exception e){ + ((List<String>) parameters.get("errorMsg")) + .add("Erreur, la tentative de finalisation des donn\xE9es du graphe a \xE9chou\xE9 "); + ((List<String>) parameters.get("errorMsg")) + .add("Cette erreur est peut \xEAtre due \xE0 une incompatibilit\xE9 des variables pour un rejoue de donn\xE9es."); + + } //-- Etape finale: creation du graphe --// graphe=new EGGraphe(model); graphe.transformer_.setXAxe(axeX); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MVProfileCourbeModel.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -370,8 +370,9 @@ LineString polyligne = (LineString) liste.get(2); // -- etape 4: recherche du source qui contient le path donn\xE9 --// + String idSource =null; if (projet != null && liste.size() >= 4) { - String idSource = (String) liste.get(3); + idSource = (String) liste.get(3); src = projet.findSourceById(idSource); if (src != null) this.data_ = src; else { @@ -409,7 +410,64 @@ this.builder_ = new EfLineIntersectionsResultsBuilder(polyligne, this.res_, new MvProfileCoteTester()); // -- rejouer les donn\xE9es --// - this.computeY(projet.impl_.getMainProgression()); + final List<String> listeReloadSource=(List<String>) infos.get("RELOAD"); + + if(listeReloadSource!=null && projet!=null && src!=null && idSource!=null &&listeReloadSource.contains(idSource)){ + + try{ + this.computeY(projet.impl_.getMainProgression()); + }catch(Exception e){ + ((List<String>) infos.get("errorMsg")) + .add("Erreur, la tentative de rejouer les donn\xE9es pour le graphe profil spatial "+getTitle()+" a \xE9chou\xE9 avec le fichier d'id " + idVar); + ((List<String>) infos.get("errorMsg")) + .add("Par cons\xE9quent les anciens y seront recharg\xE9s (ceux stock\xE9s dans le fichier xml)"); + //-- on recopie les y du fichier xml --// + if(infos.get("DEFAULTY")==null) + return; + double[] classicalValues=(double[])infos.get("DEFAULTY"); + y_ = new TDoubleArrayList(classicalValues); + + if(y_==null || y_.size()==0) + return; + + double min=y_.get(0); + double max=y_.get(0); + + for(int k=1;k<y_.size();k++){ + if(min>y_.get(k)) + min=y_.get(k); + if(max<y_.get(k)) + max=y_.get(k); + + } + yMax_=max; + yMin_=min; + } + + }else{ + //-- on recopie les y du fichier xml --// + if(infos.get("DEFAULTY")==null) + return; + double[] classicalValues=(double[])infos.get("DEFAULTY"); + y_ = new TDoubleArrayList(classicalValues); + + if(y_==null || y_.size()==0) + return; + + double min=y_.get(0); + double max=y_.get(0); + + for(int k=1;k<y_.size();k++){ + if(min>y_.get(k)) + min=y_.get(k); + if(max<y_.get(k)) + max=y_.get(k); + + } + yMax_=max; + yMin_=min; + + } } public void viewGenerationSource(Map infos, CtuluUI impl) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/meshviewer/profile/MvProfileTreeModel.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -860,7 +860,12 @@ //-- recherche ou creation du bon groupe correspondant--// nvGroupe=getGroup(model.variable_,true); //nvGroupe.addEGComponent(courbe); - + + //-- on recopie l'axe Y pour ses propri\xE9t\xE9s (grilles marqueurs...)--// + if(nvGroupe!=null) + nvGroupe.setAxeY(groupe.getAxeY()); + + listeCourbeToAdd.add(courbe); //-- ajout du groupe dans la liste a supprimer --// @@ -869,6 +874,12 @@ }else if(courbe.getModel()!=null && (courbe.getModel() instanceof ScopeCourbeModel)){ //-- on cree le groupe sans car la courbe n'est pas profil spatioal, elel peut etre socpgen--// nvGroupe=getGroup(H2dVariableType.SANS,true); + + //-- on recopie l'axe Y pour ses propri\xE9t\xE9s (grilles marqueurs...)--// + if(nvGroupe!=null) + nvGroupe.setAxeY(groupe.getAxeY()); + + //nvGroupe.addEGComponent(courbe); //listeVar.put(groupe, MvProfileFillePanel.createGroupFor(H2dVariableType.SANS)); listeCourbeToAdd.add(courbe); Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/TrLauncherDefault.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -420,10 +420,10 @@ public TrPostImplementation openLayoutPost(final File _f) { //-- version scop ou non --// - if(TrApplicationManager.isScopFormat(_f)){ - return openScopPost(_f); - - } +// if(TrApplicationManager.isScopFormat(_f)){ +// return openScopPost(_f); +// +// } final TrPostImplementation alreadyOpened = findPostWithOpenedFile(_f); if (alreadyOpened != null) { Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrApplicationManager.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -8,6 +8,7 @@ */ package org.fudaa.fudaa.tr.common; +import java.awt.event.ActionEvent; import java.io.File; import java.util.HashMap; import java.util.Map; @@ -29,6 +30,8 @@ import org.fudaa.dodico.telemac.io.ScopeTFileFormat; import org.fudaa.dodico.telemac.io.SerafinFileFilter; import org.fudaa.dodico.telemac.io.SerafinFileFormat; +import org.fudaa.ebli.commun.EbliActionSimple; +import org.fudaa.ebli.ressource.EbliResource; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.commun.FudaaUI; import org.fudaa.fudaa.commun.exec.FudaaAppliManagerImpl; @@ -375,7 +378,9 @@ launcher_ = _launcher; } - private static BuMenu buildMenuOuvrirAvec(final TrExplorer _explorer) { + BuMenuItem itemOpenScop_=null; + + private BuMenu buildMenuOuvrirAvec(final TrExplorer _explorer) { return new BuDynamicMenu(TrResource.getS("Ouvrir avec..."), "LAUNCH", BuResource.BU.getIcon("aucun")) { @Override @@ -392,6 +397,10 @@ for (int i = 0; i < nb; i++) { add(_explorer.createFileAction(_explorer.getAppliManager().getExec(i))); } + + //-- ajout du format scop --// + add(addScopExe(_explorer),0); + } } @@ -403,6 +412,26 @@ }; } + /** + * Action qui ajoute une action pour executer un fichier en mode scop. + * Tres utile car les ficheirs scop disposent souvant d'extensions non reconnues. + * @param _explorer + * @return + */ + private BuMenuItem addScopExe(final TrExplorer _explorer){ + //-- on ajoute l'option ouvrir avec le format scop --// + + EbliActionSimple action=new EbliActionSimple(TrResource.getS("Format SCOP"),EbliResource.EBLI.getIcon("curves"),"OPENSCOP"){ + public void actionPerformed(ActionEvent event){ + + ouvrirScopSansVerif(_explorer.getSelectedFile(),null); + } + }; + return new BuMenuItem(action); + + + } + protected void buildCmdForMenuFileOpenWith(final BuMenu _m, final TrExplorer _explor) { /* * _m.add(_explor.createFileAction(getTextExec())); _m.add(_explor.createFileAction(getConsoleExec())); @@ -568,17 +597,26 @@ protected String ouvrirScop(final VfsFile _f, final AbstractButton _lb) { // --si le format est du type *.POST if (isScopFormat(_f)) { - final String res = TrResource.getPostName(); + return ouvrirScopSansVerif(_f, _lb); + } + return null; + } + /** + * Ouvre un fichier de type scop sans verifier son extension. + * Necessaire pour l'execution de l'option ouvrir avec format scop car la plupart des fichiers scop ont des extensions exotiques, donc non reconnues... + * @param _f + * @param _lb + * @return + */ + protected String ouvrirScopSansVerif(final VfsFile _f, final AbstractButton _lb) { + final String res = TrResource.getPostName(); if (_lb == null) { - launcher_.openLayoutPost(_f); + launcher_.openScopPost(_f); } else { _lb.setIcon(TrResource.getScopIcon()); } return res; - } - return null; - } - + } protected String ouvrirPost(final VfsFile _f, final AbstractButton _lb) { if (isPostFormat(_f)) { @@ -600,13 +638,14 @@ String res = ouvrirEditor(_f, _lb); if (res != null) { return res; } + // -- tentative ouverture fichier type layout --// + res = ouvrirPostLayout(_f, _lb); + if (res != null) { return res; } //-- tentative ouverture fichier scop --// res=ouvrirScop(_f, _lb); if (res != null) { return res; } - // -- tentative ouverture fichier type layout --// - res = ouvrirPostLayout(_f, _lb); - if (res != null) { return res; } + res = ouvrirMesh(_f, _lb); if (res != null) { return res; } @@ -656,6 +695,10 @@ */ public void buildCmdForMenuFile(final JPopupMenu _m, final TrExplorer _explor) { openWith_ = buildMenuOuvrirAvec(_explor); + + + + _m.add(openWith_); } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrExplorer.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -205,7 +205,7 @@ BuMenuItem itemEditSetupLayout_=null; - + @Override protected void updateMenuFiles() { final int l = files_.getSelectedValues().length; @@ -219,9 +219,11 @@ //-- on degage l'editeur de texte specifique setup post si existe --// if(itemEditSetupLayout_!=null && pmFiles_.getComponentIndex(itemEditSetupLayout_)!=-1) pmFiles_.remove(itemEditSetupLayout_); - +// if(itemOpenScop_!=null && pmFiles_.getComponentIndex(itemOpenScop_)!=-1) +// pmFiles_.remove(itemOpenScop_); + //-- on v\xE9rifie qu'il s'agit d'un fichier de type POST, si oui on ajoute --// - final File selection=getSelectedFile(); + final VfsFile selection=getSelectedFile(); if(TrPostFileFilter.acceptDirectoryPOST(selection)){ EbliActionSimple action=new EbliActionSimple(TrResource.getS("Editer le fichier Setup"),EbliResource.EBLI.getIcon("text"),"EDITSETUP"){ public void actionPerformed(ActionEvent event){ @@ -236,6 +238,21 @@ //-- on ajoute l'editeur du fichier setup en deuxieme position --// itemEditSetupLayout_=new BuMenuItem(action); pmFiles_.add(itemEditSetupLayout_, 1); + }else{ +// +// //-- on ajoute l'option ouvrir avec le format scop --// +// if(!appli_.isGridFormat(selection) || !(appli_.isNotSerafinResFile(selection))){ +// EbliActionSimple action=new EbliActionSimple(TrResource.getS("Ouvrir au format SCOP"),EbliResource.EBLI.getIcon("curves"),"OPENSCOP"){ +// public void actionPerformed(ActionEvent event){ +// appli_.ouvrirScop(selection,null); +// +// +// } +// }; +// itemOpenScop_=new BuMenuItem(action); +// pmFiles_.add(itemOpenScop_,1); + // } + } Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLauncher.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLauncher.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/common/TrLauncher.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -52,6 +52,8 @@ */ TrPostImplementation openLayoutPost(File _f); + TrPostImplementation openScopPost(File _f); + /** * @param _f le fichier a ouvrir dans la fenetre de visu de maillage. */ Modified: branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-02-12 17:10:04 UTC (rev 4459) +++ branches/Prepro-0.92-SNAPSHOT/fudaa/src/org/fudaa/fudaa/tr/post/TrPostCourbeModel.java 2009-02-12 20:39:45 UTC (rev 4460) @@ -7,6 +7,8 @@ */ package org.fudaa.fudaa.tr.post; +import gnu.trove.TDoubleArrayList; + import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -482,12 +484,34 @@ setSelectionPoint(point); //-- FAUT il rejouer les donnees?? --// - //final List<String> listeReloadSource=(List<String>) infos.get("RELOAD"); + final List<String> listeReloadSource=(List<String>) infos.get("RELOAD"); - //if(listeReloadSource!=null && projet!=null && this.source_!=null && listeReloadSource.contains(idSource)){ + if(listeReloadSource!=null && projet!=null && this.source_!=null && listeReloadSource.contains(idSource)){ //-- on rejoue les donn\xE9es : methode specialisee replayData--// - this.updateY(); - //} + try{ + this.updateY(); + }catch(Exception e){ + ((List<String>) infos.get("errorMsg")) + .add("Erreur, la tentative de rejouer les donn\xE9es pour le graphe \xE9colution temporel "+getTitle()+" a \xE9chou\xE9 avec le fichier d'id " + idVar); + ((List<String>) infos.get("errorMsg")) + .add("Par cons\xE9quent les anciens y seront recharg\xE9s (ceux stock\xE9s dans le fichier xml)"); + //-- on recopie les y du fichier xml --// + if(infos.get("DEFAULTY")==null) + return; + double[] classicalValues=(double[])infos.get("DEFAULTY"); + y_ = classicalValues; + } + + + }else{ + + //-- on recopie les y du fichier xml --// + if(infos.get("DEFAULTY")==null) + return; + double[] classicalValues=(double[])infos.get("DEFAULTY"); + y_ = classicalValues; + } + // if(listeReloadSource!=null && projet!=null && this.source_!=null && listeReloadSource.contains(idSource)){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-02-12 17:10:09
|
Revision: 4459 http://fudaa.svn.sourceforge.net/fudaa/?rev=4459&view=rev Author: emmanuel_martin Date: 2009-02-12 17:10:04 +0000 (Thu, 12 Feb 2009) Log Message: ----------- Impl?\195?\169mentation partielle de la tache #178 (suite) Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/BiefSet.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/test/testModeleur1d/TestProfilContainerAdapter.java Added Paths: ----------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefsImporterFromModeleur2d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/CancelException.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsBief1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueImportation.java Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java 2009-02-12 17:10:04 UTC (rev 4459) @@ -0,0 +1,574 @@ +/* + * @creation 11 f\xE9vr. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.modeleur1d.controller; + +import org.fudaa.ctulu.gis.GISAttributeConstants; +import org.fudaa.ctulu.gis.GISAttributeInterface; +import org.fudaa.ctulu.gis.GISAttributeModel; +import org.fudaa.ctulu.gis.GISAttributeModelDoubleArray; +import org.fudaa.ctulu.gis.GISAttributeModelDoubleInterface; +import org.fudaa.ctulu.gis.GISAttributeModelIntegerList; +import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; +import org.fudaa.ctulu.gis.GISCoordinateSequenceFactory; +import org.fudaa.ctulu.gis.GISLib; +import org.fudaa.ctulu.gis.GISPolyligne; +import org.fudaa.ctulu.gis.GISReprojectInterpolateur1DDouble; +import org.fudaa.ctulu.gis.GISZoneCollection; +import org.fudaa.ctulu.gis.GISZoneCollectionGeometry; +import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; +import org.fudaa.ebli.calque.ZModeleLigneBrisee; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.modeleur.layer.MdlModel1dAxe; +import org.fudaa.fudaa.modeleur.layer.MdlModel1dBank; +import org.fudaa.fudaa.modeleur.layer.MdlModel1dLimiteStockage; +import org.fudaa.fudaa.modeleur.layer.MdlModel2dConstraintLine; +import org.fudaa.fudaa.modeleur.layer.MdlModel2dDirectionLine; +import org.fudaa.fudaa.modeleur.layer.MdlModel2dProfile; +import org.fudaa.fudaa.modeleur.modeleur1d.model.Bief; +import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsBief1d; +import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsProfil1d; +import org.fudaa.fudaa.modeleur.modeleur1d.view.VueImportation; + +import com.vividsolutions.jts.geom.Coordinate; +import com.vividsolutions.jts.geom.CoordinateSequence; +import com.vividsolutions.jts.geom.Geometry; + +/** + * Import un bief a partir d'un tableau de modeles. + * + * Cette classe est dans les controlleurs car elle peut instancier une vue pour + * demander \xE0 l'utilisateur certaines informations suppl\xE9mentaires. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class BiefImporterFromModels { + + /** Le tableau de mod\xE8le tel que donn\xE9 \xE0 la construction de l'instance. */ + private ZModeleLigneBrisee[] models_; + // Les mod\xE8les en fonction de le contenu. Se sont les m\xEAmes que dans models_. + private ZModeleLigneBrisee axeHydraulique_; + private ZModeleLigneBrisee profils_; + private ZModeleLigneBrisee rives_; + private ZModeleLigneBrisee limitesStockages_; + private ZModeleLigneBrisee lignesDirectrices_; + private ZModeleLigneBrisee lignesContraints_; + + public BiefImporterFromModels(ZModeleLigneBrisee[] _models) { + if (_models==null) + throw new IllegalArgumentException(FudaaLib.getS("_models ne peut pas \xEAtre null.")); + models_=_models; + } + + /** + * @return le bief r\xE9sultant des mod\xE8les. + * @throws CancelException + */ + public Bief getBief() throws CancelException { + buildBief(); + Bief bief=new Bief(axeHydraulique_, lignesContraints_, lignesDirectrices_, limitesStockages_, profils_, rives_); + bief.enableSynchroniser(); + return bief; + } + + /** + * Construit les mod\xE8les. + * @throws CancelException + */ + private void buildBief() throws CancelException { + testAndValuateModels(); + // Valuation des attributs sp\xE9cifiques au 1d pour les profils \\ + GISZoneCollection zone=profils_.getGeomData(); + UtilsBief1d.normalizeProfilAttributes(zone); + normalizePKData(); + + int idxAttRiveGauche=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); + int idxAttRiveDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); + int idxAttlsGauche=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); + int idxAttlsDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); + int idxAttLignesDirectrices=zone.getIndiceOf(GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); + + UtilsBief1d.orderProfils(profils_, -1, null); + // Normalise le sens du profil \\ + for (int k=0; k<profils_.getNombre(); k++) { + Geometry profil=zone.getGeometry(k); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + // Normalisation du sens (gauche/droite) du profil \\ + Coordinate interAxeProfil=seqProfil.getCoordinate(seqProfil.size()/2); + // Cr\xE9ation du vecteur contenant le sens de l'axe hydraulique + Coordinate vAxeH=null; + boolean noReorientation=false; + if (k>0) { + CoordinateSequence profilPrevious=zone.getCoordinateSequence(k-1); + Coordinate pointProfilPrevious=profilPrevious.getCoordinate(profilPrevious.size()/2); + vAxeH=new Coordinate(interAxeProfil.x-pointProfilPrevious.x, interAxeProfil.y-pointProfilPrevious.y, 0); + } + else if (k<profils_.getNombre()-1) { + CoordinateSequence profilPrevious=zone.getCoordinateSequence(k+1); + Coordinate pointProfilPrevious=profilPrevious.getCoordinate(profilPrevious.size()/2); + vAxeH=new Coordinate(pointProfilPrevious.x-interAxeProfil.x, pointProfilPrevious.y-interAxeProfil.y, 0); + } + else { + if (axeHydraulique_.getNombre()>0) { + Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); + CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); + // Normalisation du sens (gauche/droite) du profil \\ + Coordinate interAxeProfil2=profil.intersection(axeHydraulique).getCoordinate(); + // Cr\xE9ation du vecteur contenant le sens de l'axe hydraulique + int idxPrevious=UtilsProfil1d.getPreviousIndex(seqAxeHydraulique, interAxeProfil2); + int idxNext=UtilsProfil1d.getNextIndex(seqAxeHydraulique, interAxeProfil2); + if (idxPrevious!=-1) + vAxeH=new Coordinate(interAxeProfil2.x-seqAxeHydraulique.getCoordinate(idxPrevious).x, interAxeProfil2.y + -seqAxeHydraulique.getCoordinate(idxPrevious).y, 0); + else + vAxeH=new Coordinate(seqAxeHydraulique.getCoordinate(idxNext).x-interAxeProfil2.x, seqAxeHydraulique + .getCoordinate(idxNext).y + -interAxeProfil2.y, 0); + } + else + // Pas de r\xE9orientatin du profil dans ce cas l\xE0. + noReorientation=true; + } + // Cr\xE9ation du vecteur contenant le sens du profil + if (!noReorientation) { + Coordinate vProfilH; + int idxPrevious=UtilsProfil1d.getPreviousIndex(seqProfil, interAxeProfil); + int idxNext=UtilsProfil1d.getNextIndex(seqProfil, interAxeProfil); + if (idxPrevious!=-1) + vProfilH=new Coordinate(interAxeProfil.x-seqProfil.getCoordinate(idxPrevious).x, interAxeProfil.y + -seqProfil.getCoordinate(idxPrevious).y, 0); + else + vProfilH=new Coordinate(seqProfil.getCoordinate(idxNext).x-interAxeProfil.x, seqProfil.getCoordinate(idxNext).y + -interAxeProfil.y, 0); + // Inversion du sens du profil si besoin + double produitVectorielCoordZ=vAxeH.x*vProfilH.y-vAxeH.y*vProfilH.x; + if (produitVectorielCoordZ>0) { + inverseProfil(k); + profil=(Geometry)profils_.getGeomData().getGeometry(k); + seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + } + } + } + // Cr\xE9ation des nouveaux points sur les profils \\ + for (int k=0; k<profils_.getNombre(); k++) { + // Ajout des points au profil si n\xE9c\xE9ssaire pour les intersections \\ + // Lignes de contraintes + for (int l=0; l<lignesContraints_.getNombre(); l++) + createPointIfNeededKeepZ(k, l, lignesContraints_); + // Rives + for (int l=0; l<rives_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne)rives_.getObject(l)); + // Limites de stockages + for (int l=0; l<limitesStockages_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne)limitesStockages_.getObject(l)); + // Lignes directrices + for (int l=0; l<lignesDirectrices_.getNombre(); l++) + createPointIfNeeded(k, (GISPolyligne)lignesDirectrices_.getObject(l)); + } + // Valuation des attributs simple d'intersection (rives et limites) \\ + for (int k=0; k<profils_.getNombre(); k++) { + CoordinateSequence seqProfil=zone.getCoordinateSequence(k); + double abscisseCurvIntersectionAxe; + if (axeHydraulique_.getNombre()>0) + abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, axeHydraulique_.getGeomData() + .getCoordinateSequence(0)); + else + abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, seqProfil.getCoordinate(seqProfil.size()-1))/2; + // Valuation des attributs avec les index des points des intersections \\ + // Rives + zone.setAttributValue(idxAttRiveGauche, k, 0, null); + zone.setAttributValue(idxAttRiveDroite, k, seqProfil.size()-1, null); + for (int l=0; l<rives_.getNombre(); l++) + valuateProfilIntersection(k, (Geometry)rives_.getObject(l), idxAttRiveGauche, idxAttRiveDroite, abscisseCurvIntersectionAxe); + // D\xE9tection des croisements zones de stockages droite et gauche \\ + // Limites de stockages + zone.setAttributValue(idxAttlsGauche, k, 0, null); + zone.setAttributValue(idxAttlsDroite, k, seqProfil.size()-1, null); + for (int l=0; l<limitesStockages_.getNombre(); l++) + valuateProfilIntersection(k, (Geometry)limitesStockages_.getObject(l), idxAttlsGauche, idxAttlsDroite, + abscisseCurvIntersectionAxe); + } + // Valuation des attributs composites d'intersection (lignes directrices) \\ + // Lignes directrices \\ + valuateProfilIntersection(idxAttLignesDirectrices); + + // Valuation des attributs sp\xE9cifique au 1d pour l'axe hydraulique \\ + UtilsBief1d.normalizeAxeHydrauliqueAttributes(axeHydraulique_.getGeomData()); + } + + /** + * Normalise les informations PK. + * @throws CancelException si l'imortation est annul\xE9e. + */ + private void normalizePKData() throws CancelException { + GISZoneCollection zone=profils_.getGeomData(); + int idxAttCommentaireHydraulique=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + // Vrai si les PK existes. + boolean attrIsCorrectlyValued=false; + // Vrai si les PK existe et correspond \xE0 l'axe hydraulique si il existe. + boolean attrMatchWithAxeHydraulique=false; + boolean presenceAxeHydraulique=axeHydraulique_.getNombre()>0; + if (idxAttCommentaireHydraulique!=-1) { + attrIsCorrectlyValued=true; + if(presenceAxeHydraulique) + attrMatchWithAxeHydraulique=true; + int i=-1; + while (attrIsCorrectlyValued&&++i<profils_.getNombre()) { + // V\xE9rification de la pr\xE9sence des donn\xE9es PK \\ + String CommHydrauValue=(String)profils_.getGeomData().getValue(idxAttCommentaireHydraulique, i); + attrIsCorrectlyValued=GISLib.isHydroCommentValued(CommHydrauValue, "PK"); + // V\xE9rification de la coh\xE9rence avec l'axe hydraulique \\ + if (presenceAxeHydraulique) { + double hydraoCommValue=GISLib.getHydroCommentDouble(CommHydrauValue, "PK"); + double absCurvValue=UtilsProfil1d.abscisseCurviligne(axeHydraulique_.getGeomData().getCoordinateSequence(0), profils_ + .getGeomData().getCoordinateSequence(i)); + if (absCurvValue==-1) + throw new IllegalArgumentException(FudaaLib + .getS("Au moins un des profils coupe plusieurs fois ou jamais l'axe hydraulique.")); + attrMatchWithAxeHydraulique=attrIsCorrectlyValued&&attrMatchWithAxeHydraulique + &&Math.abs(hydraoCommValue-absCurvValue)<0.0001; + } + } + } + if (idxAttCommentaireHydraulique==-1) + // Ajout de l'attribut COMMENTAIRE_HYDRO + if (idxAttCommentaireHydraulique==-1) { + GISAttributeInterface[] atts=new GISAttributeInterface[zone.getNbAttributes()+1]; + for (int k=0; k<zone.getNbAttributes(); k++) + atts[k]=zone.getAttribute(k); + atts[atts.length-1]=GISAttributeConstants.COMMENTAIRE_HYDRO; + zone.setAttributes(atts, null); + } + if (!attrIsCorrectlyValued) { + // Valuation de l'attribut, a partir de l'axe hydrau si il existe, 0 + // sinon. + idxAttCommentaireHydraulique=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + for (int k=0; k<zone.getNumGeometries(); k++) { + String comm=(String)profils_.getGeomData().getValue(idxAttCommentaireHydraulique, k); + if (!GISLib.isHydroCommentValued(comm, "PK")) + if (presenceAxeHydraulique) { + // Valuation avec le croisement avec l'axe hydraulique + double abscurv=UtilsProfil1d.abscisseCurviligne(axeHydraulique_.getGeomData().getCoordinateSequence(0), profils_ + .getGeomData().getCoordinateSequence(k)); + zone.setAttributValue(idxAttCommentaireHydraulique, k, GISLib.setHydroCommentDouble(comm, abscurv, "PK"), null); + } + else + // Valuation avec 0 + zone.setAttributValue(idxAttCommentaireHydraulique, k, GISLib.setHydroCommentDouble(comm, 0, "PK"), null); + } + attrMatchWithAxeHydraulique=true; + } + if (!attrMatchWithAxeHydraulique&&presenceAxeHydraulique) { + VueImportation vImport=new VueImportation(); + if (!vImport.run()) + throw new CancelException(FudaaLib.getS("L'importation a \xE9t\xE9 annul\xE9.")); + if (vImport.axeHydrauChosen()) { + // Ecrasement des anciennes valeurs de PK \\ + idxAttCommentaireHydraulique=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + for (int k=0; k<zone.getNumGeometries(); k++) { + String comm=(String)profils_.getGeomData().getValue(idxAttCommentaireHydraulique, k); + // Valuation avec le croisement avec l'axe hydraulique + double abscurv=UtilsProfil1d.abscisseCurviligne(axeHydraulique_.getGeomData().getCoordinateSequence(0), profils_ + .getGeomData().getCoordinateSequence(k)); + zone.setAttributValue(idxAttCommentaireHydraulique, k, GISLib.setHydroCommentDouble(comm, abscurv, "PK"), null); + } + } + else { + // Destruction de l'axe hydraulique \\ + int[] idxAH=new int[axeHydraulique_.getNombre()]; + for (int i=0; i<idxAH.length; i++) + idxAH[i]=i; + axeHydraulique_.getGeomData().removeGeometries(idxAH, null); + } + } + } + + /** + * Value les attributs priv\xE9s a partir du tableau de ZModeleLigneBrisee. + * + * @param _models + */ + private void testAndValuateModels() { + for (int i=0; i<models_.length; i++) { + if (models_[i]==null) + throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : _models ne doit pas contenir de valeurs null")); + if (models_[i].getGeomData()==null) + throw new IllegalArgumentException(FudaaLib.getS("Erreur programmation : Certain model n'ont pas de GSIZoneCollection.")); + if (!(models_[i].getGeomData() instanceof GISZoneCollectionLigneBrisee)) + throw new IllegalArgumentException(FudaaLib + .getS("Erreur programmation : Toutes les GISZone doivent \xEAtre des GISZoneCollectionLigneBrisee.")); + String nature=(String)models_[i].getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE); + if (nature==null) + throw new IllegalArgumentException(FudaaLib.getS("Un des modeles ne contient pas l'attribut NATURE.")); + if (nature==GISAttributeConstants.ATT_NATURE_AH) + if (axeHydraulique_!=null) + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models d'axe hydrauliques sont donn\xE9es.")); + else + axeHydraulique_=models_[i]; + else if (nature==GISAttributeConstants.ATT_NATURE_LD) + if (lignesDirectrices_!=null) + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de lignes directrices sont donn\xE9es.")); + else + lignesDirectrices_=models_[i]; + else if (nature==GISAttributeConstants.ATT_NATURE_LS) + if (limitesStockages_!=null) + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de limites de stockage sont donn\xE9es.")); + else if (models_[i].getGeomData().getNbGeometries()>2) + throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plus de 2 limites de stockages.")); + else + limitesStockages_=models_[i]; + else if (nature==GISAttributeConstants.ATT_NATURE_PF) + if (profils_!=null) + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de profils sont donn\xE9es.")); + else + profils_=models_[i]; + else if (nature==GISAttributeConstants.ATT_NATURE_RV) + if (rives_!=null) + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de rives sont donn\xE9es.")); + else if (models_[i].getGeomData().getNbGeometries()>2) + throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plus de 2 rives.")); + else + rives_=models_[i]; + else if (nature==GISAttributeConstants.ATT_NATURE_LC) + if (lignesContraints_!=null) + throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models de lignes de contraintes sont donn\xE9es.")); + else + lignesContraints_=models_[i]; + } + // Remplissage des models vides par des ZModeles vides + if (axeHydraulique_==null) + axeHydraulique_=new MdlModel1dAxe(null); + if (profils_==null) + profils_=new MdlModel2dProfile(null, null); + if (rives_==null) + rives_=new MdlModel1dBank(null, null); + if (limitesStockages_==null) + limitesStockages_=new MdlModel1dLimiteStockage(null, null); + if (lignesDirectrices_==null) + lignesDirectrices_=new MdlModel2dDirectionLine(null, null); + if (lignesContraints_==null) + lignesContraints_=new MdlModel2dConstraintLine(null, null); + } + + /** + * Inverse le sens du profil dont l'index est pass\xE9 en param\xE8tre. + */ + private void inverseProfil(int _idxProfil) { + GISZoneCollection zone=profils_.getGeomData(); + Coordinate[] coords=((Geometry)zone.getGeometry(_idxProfil)).getCoordinates(); + for (int l=0; l<coords.length/2; l++) { + // Inversion des coordonn\xE9es + Coordinate tmp=coords[l]; + coords[l]=coords[coords.length-1-l]; + coords[coords.length-1-l]=tmp; + // Inversion des attributs atomiques + for (int i=0; i<zone.getNbAttributes(); i++) + if (zone.getAttribute(i).isAtomicValue()) { + GISAttributeModel model=(GISAttributeModel)zone.getDataModel(i).getObjectValueAt(_idxProfil); + Object valueTmp=model.getObjectValueAt(l); + model.setObject(l, model.getObjectValueAt(coords.length-1-l), null); + model.setObject(l, valueTmp, null); + } + } + zone.setCoordinateSequence(_idxProfil, new GISCoordinateSequenceFactory().create(coords), null); + } + + /** + * Valuation des attributs *gauche et *droite des profils. + * + * @param _idxProfil + * l'index du profil concern\xE9. + * @param _ligne + * la ligne qui est sens\xE9 crois\xE9 le profil. + * @param _idxAttrGauche + * l'index de l'attribut gauche o\xF9 sera mit l'information en cas de + * croisement \xE0 gauche. + * @param _idxAttrDroite + * l'index de l'attribut gauche o\xF9 sera mit l'information en cas de + * croisement \xE0 droite. + * @param _absCurvAxeHydrau + * la valeur de l'abscisse curviligne de l'axe hydrau sur le profil. + */ + private void valuateProfilIntersection(int _idxProfil, Geometry _ligne, int _idxAttrGauche, int _idxAttrDroite, + double _absCurvAxeHydrau) { + Geometry inter=_ligne.intersection((Geometry)profils_.getObject(_idxProfil)); + if (inter.getNumPoints()==1) { + Coordinate coord=inter.getCoordinate(); + int idxIntersection=UtilsProfil1d.getIndex(profils_.getGeomData().getCoordinateSequence(_idxProfil), coord); + if (_absCurvAxeHydrau<UtilsProfil1d.abscisseCurviligne(profils_.getGeomData().getCoordinateSequence(_idxProfil), coord)) + profils_.getGeomData().setAttributValue(_idxAttrDroite, _idxProfil, idxIntersection, null); + else + profils_.getGeomData().setAttributValue(_idxAttrGauche, _idxProfil, idxIntersection, null); + } + } + + /** + * Valuation des attributs composites des profils, c'est \xE0 dire des attributs + * contenant plusieurs informations d'intersection sous forme d'une liste. + * + * @param _idxAttr + * l'index de l'attribut o\xF9 sera stock\xE9 les intersections + */ + private void valuateProfilIntersection(int _idxAttr) { + // Cr\xE9ation des listes + for (int k=0; k<profils_.getNombre(); k++) { + GISAttributeModelIntegerList attrModel=new GISAttributeModelIntegerList(0, + GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); + attrModel.setListener(profils_.getGeomData()); + profils_.getGeomData().setAttributValue(_idxAttr, k, attrModel, null); + } + // Valuation de l'attribut + int k=0; + int[] lstIntersectionTmp=new int[profils_.getNombre()]; + while (k<lignesDirectrices_.getNombre()) { + Geometry ligneD=(Geometry)lignesDirectrices_.getObject(k); + // Recherche des croisements avec les profils + for (int l=0; l<profils_.getNombre(); l++) { + Geometry profil=profils_.getGeomData().getGeometry(l); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + Geometry inter=((Geometry)profils_.getObject(l)).intersection(ligneD); + if (inter.getNumPoints()==0) + lstIntersectionTmp[l]=-1; + else + lstIntersectionTmp[l]=UtilsProfil1d.getIndex(seqProfil, inter.getCoordinate()); + } + // Test si au moins un croisement existe + boolean ok=false; + int m=-1; + while (!ok&&++m<lstIntersectionTmp.length) + ok=lstIntersectionTmp[m]!=-1; + if (!ok) + // Suppression de la ligne directrice qui est inutile et pas + // incr\xE9mentation de k + lignesDirectrices_.getGeomData().removeGeometries(new int[]{k}, null); + else { + for (int l=0; l<profils_.getNombre(); l++) { + // R\xE9cup\xE9ration de la liste contenant les index + GISAttributeModelIntegerList lst=(GISAttributeModelIntegerList)profils_.getGeomData().getValue(_idxAttr, l); + if (lstIntersectionTmp[l]!=-1) + // Enregistrement de l'index + lst.add(lstIntersectionTmp[l]); + else { + // Place le permier ou le dernier index \\ + // Recherche d'un point avant + int idxTest=l; + while (idxTest>=0&&lstIntersectionTmp[idxTest]==-1) + idxTest--; + if (idxTest<0) { + // Recherche d'un point apr\xE8s + idxTest=l; + while (idxTest<lstIntersectionTmp.length&&lstIntersectionTmp[idxTest]==-1) + idxTest++; + } + // Extraction d'informations sur le profils et l'axe hydraulique + Geometry profil=profils_.getGeomData().getGeometry(idxTest); + CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + int idxAxe; + if (axeHydraulique_.getNombre()==0) + idxAxe=seqProfil.size()/2; + else { + Coordinate intersection=profil.intersection((Geometry)axeHydraulique_.getObject(0)).getCoordinate(); + idxAxe=UtilsProfil1d.getPreviousIndex(seqProfil, intersection); + if (idxAxe==-1) + idxAxe=0; + } + // Enregistrement de l'index + if (lstIntersectionTmp[idxTest]<=idxAxe) + lst.add(0); + else + lst.add(profils_.getGeomData().getCoordinateSequence(l).size()-1); + } + } + k++; + } + } + } + + /** + * Cr\xE9e un point \xE0 l'intersection du profil indiqu\xE9 par _idxProfil et de + * _ligne. + */ + private void createPointIfNeeded(int _idxProfil, GISPolyligne _ligne) { + Geometry inter=_ligne.intersection((Geometry)profils_.getObject(_idxProfil)); + CoordinateSequence seq=profils_.getGeomData().getCoordinateSequence(_idxProfil); + if (inter.getNumPoints()==1) { + Coordinate coord=inter.getCoordinate(); + int previousIdx=UtilsProfil1d.getPreviousIndex(seq, coord); + int nextIdx=UtilsProfil1d.getNextIndex(seq, coord); + // Le point n'appartient pas au profil ou La coordonn\xE9e correspond d\xE9j\xE0 \xE0 + // un point + if (previousIdx!=-2&&nextIdx!=-2&&previousIdx+1!=nextIdx-1&&nextIdx!=-1&&previousIdx!=-1) + // La coordonn\xE9e correspond \xE0 aucun point connu + ((GISZoneCollectionGeometry)profils_.getGeomData()).addAtomic(_idxProfil, previousIdx, coord.x, coord.y, null); + } + } + + /** + * Cr\xE9e un point \xE0 l'intersection du profil indiqu\xE9 par _idxProfil et de + * _ligne. Le z du point cr\xE9e prendra la valeur z du point correspondant dans + * _ligne (interpol\xE9 si n\xE9c\xE9ssaire). + */ + private void createPointIfNeededKeepZ(int _idxProfil, int _idxLigne, ZModeleLigneBrisee _modelLigne) { + GISZoneCollection zoneLigne=_modelLigne.getGeomData(); + GISZoneCollection zoneProfil=profils_.getGeomData(); + GISPolyligne ligne=(GISPolyligne)zoneLigne.getGeometry(_idxLigne); + GISPolyligne profil=(GISPolyligne)zoneProfil.getGeometry(_idxProfil); + CoordinateSequence seqLigne=zoneLigne.getCoordinateSequence(_idxLigne); + CoordinateSequence seqProfil=zoneProfil.getCoordinateSequence(_idxProfil); + Geometry intersection=ligne.intersection(profil); + if (intersection.getNumPoints()==1) { + Coordinate coordIntersection=intersection.getCoordinate(); + int previousIdx=UtilsProfil1d.getPreviousIndex(seqProfil, coordIntersection); + int nextIdx=UtilsProfil1d.getNextIndex(seqProfil, coordIntersection); + // Le point n'appartient pas au profil ou La coordonn\xE9e correspond d\xE9j\xE0 \xE0 + // un point + if (previousIdx!=-2&&nextIdx!=-2&&previousIdx+1!=nextIdx-1&&nextIdx!=-1&&previousIdx!=-1) { + // La coordonn\xE9e correspond \xE0 aucun point connu + ((GISZoneCollectionGeometry)zoneProfil).addAtomic(_idxProfil, previousIdx, coordIntersection.x, coordIntersection.y, null); + seqProfil=zoneProfil.getCoordinateSequence(_idxProfil); + } + // Valuation du z par la valeur de la ligne si _zLigne \xE0 vrai + if (zoneLigne.getAttributeIsZ()!=null) { + int idxPProfil=UtilsProfil1d.getIndex(seqProfil, coordIntersection); + int idxPLigne=UtilsProfil1d.getIndex(seqLigne, coordIntersection); + GISAttributeModel modelZLigne=zoneLigne.getModel(zoneLigne.getAttributeIsZ()); + double z; + // Si l'attribut est global + if (!zoneLigne.getAttributeIsZ().isAtomicValue()) + z=(Double)modelZLigne.getObjectValueAt(_idxLigne); + // Le point existe dans la ligne + else if (idxPLigne!=-1) + z=(Double)((GISAttributeModel)modelZLigne.getObjectValueAt(_idxLigne)).getObjectValueAt(idxPLigne); + // Le point n'existe pas => interpole une valeur + else { + // Extraction des index pr\xE9c\xE9dent et suivant \\ + int idxPrevious=UtilsProfil1d.getPreviousIndex(seqLigne, coordIntersection); + if (idxPrevious==-1) + idxPrevious=0; + Coordinate previous=seqLigne.getCoordinate(idxPrevious); + int idxNext=UtilsProfil1d.getNextIndex(seqLigne, coordIntersection); + if (idxNext==-1) + idxNext=seqLigne.size()-1; + Coordinate next=seqLigne.getCoordinate(UtilsProfil1d.getNextIndex(seqLigne, coordIntersection)); + // Cr\xE9ation d'un model temporaire contenant les z \\ + double valZ1=(Double)((GISAttributeModel)modelZLigne.getObjectValueAt(_idxLigne)).getObjectValueAt(idxPrevious); + double valZ2=(Double)((GISAttributeModel)modelZLigne.getObjectValueAt(_idxLigne)).getObjectValueAt(idxNext); + GISAttributeModelDoubleInterface zModel=new GISAttributeModelDoubleArray(new double[]{valZ1, valZ2}, zoneLigne + .getAttributeIsZ()); + // Interpolation \\ + GISCoordinateSequenceFactory factory=new GISCoordinateSequenceFactory(); + z=new GISReprojectInterpolateur1DDouble(factory.create(new Coordinate[]{previous, next}), factory + .create(new Coordinate[]{previous, new Coordinate(coordIntersection.x, coordIntersection.y, 0), next}), zModel) + .interpol(1); + } + ((GISAttributeModel)zoneProfil.getModel(zoneProfil.getAttributeIsZ()).getObjectValueAt(_idxProfil)).setObject(idxPProfil, + z, null); + } + } + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefImporterFromModels.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefsImporterFromModeleur2d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefsImporterFromModeleur2d.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefsImporterFromModeleur2d.java 2009-02-12 17:10:04 UTC (rev 4459) @@ -0,0 +1,117 @@ +/* + * @creation 11 f\xE9vr. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.modeleur1d.controller; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.fudaa.ebli.calque.BCalque; +import org.fudaa.ebli.calque.ZModeleLigneBrisee; +import org.fudaa.fudaa.commun.FudaaLib; +import org.fudaa.fudaa.modeleur.modeleur1d.model.Bief; +import org.fudaa.fudaa.sig.layer.FSigLayerLineEditable; + +/** + * Cette classe s'occupe de g\xE9rer l'importation de donn\xE9es depuis le modeleur 2d + * vers le modeleur 1d. Cette importation peut-\xEAtre faite bief par bief. Une + * hypoth\xE8se est prise dans cette classe : le calque pass\xE9 en param\xE8tre, de m\xEAme + * pour tous ses fils, ne sont pas modifi\xE9s \xE0 l'ext\xE9rieur de cette classe + * pendant toute la dur\xE9e de sa vie. + * + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class BiefsImporterFromModeleur2d { + + /** La racine de l'arbre du 2d contenant les biefs 2d. */ + private BCalque rootCalque_; + /** La liste de nom. */ + private Map<String, Integer> names_=new HashMap<String, Integer>(); + + /** + * + * @param _rootCalque + * @param _impl peut \xEAtre null. + */ + public BiefsImporterFromModeleur2d(BCalque _rootCalque) { + if (_rootCalque==null) + throw new IllegalArgumentException(FudaaLib.getS("_rootCalque ne doit pas \xEAtre null.")); + rootCalque_=_rootCalque; + // G\xE9n\xE9ration des noms \\ + /* + * Les noms g\xE9n\xE9r\xE9s ne sont pas n\xE9c\xE9ssairement les noms donn\xE9es dans le 2d. + * La diff\xE9rence apparait quand plusieurs biefs porte le m\xEAme nom. Dans ce + * cas le nom prend la forme : nuero#nom. + */ + BCalque[] calques=rootCalque_.getCalques(); + // Extraction pour chacun des calques de son titre \\ + for (int i=0; i<calques.length; i++) + if(names_.containsKey(calques[i].getTitle())) { + // Ajout d'un num\xE9ro \xE0 la fin du nom du calque \\ + int j=2; + while(names_.containsKey(calques[i].getTitle()+" #"+j+"#")) + j++; + names_.put(calques[i].getTitle()+" #"+j+"#", i); + } + else + // Ajout simple du nom \\ + names_.put(calques[i].getTitle(), i); + } + + /** + * Les noms retourn\xE9s ne sont pas n\xE9c\xE9ssairement les noms donn\xE9es dans le 2d. + * La diff\xE9rence apparait quand plusieurs biefs porte le m\xEAme nom. Dans ce cas + * le nom prend la forme : nuero#nom. + * + * @return un tableau de String contenant les noms des biefs importables. + */ + public String[] getBiefsNames() { + return names_.keySet().toArray(new String[0]); + } + + /** + * Import le bief d\xE9fini par _name. + * + * @param _name + * le nom du bief \xE0 importer + * @return le bief construit. + * @throws CancelException + * @throws IllegalArgumentException + * si _name ne correspond \xE0 aucun bief. + */ + public Bief importBief(String _name) throws CancelException { + if (!names_.containsKey(_name)) + throw new IllegalArgumentException(FudaaLib.getS(_name+" ne correspond a aucun bief.")); + // Extraction des modeles du bief selectionn\xE9. \\ + List<ZModeleLigneBrisee> modelsBief=new ArrayList<ZModeleLigneBrisee>(); + // Iteration sur chaque calque + BCalque[] sousCalques=rootCalque_.getCalques()[names_.get(_name)].getCalques(); + for (int j=0; j<sousCalques.length; j++) + if (sousCalques[j] instanceof FSigLayerLineEditable) + modelsBief.add(((FSigLayerLineEditable)sousCalques[j]).getModele()); + // Importation du bief \\ + return new BiefImporterFromModels(modelsBief.toArray(new ZModeleLigneBrisee[0])).getBief(); + } + + /** + * Importe tous les biefs disponibles. + * @return Map<String:NomDuBief, Bief:leBief> + */ + public Map<String, Bief> importAllBiefs() { + String[] names=getBiefsNames(); + Map<String, Bief> result=new HashMap<String, Bief>(); + for(String name: names) + try { + result.put(name, importBief(name)); + } + catch (CancelException _exc) { } + return result; + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/BiefsImporterFromModeleur2d.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Added: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/CancelException.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/CancelException.java (rev 0) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/CancelException.java 2009-02-12 17:10:04 UTC (rev 4459) @@ -0,0 +1,19 @@ +/* + * @creation 12 f\xE9vr. 2009 + * @modification $Date:$ + * @license GNU General Public License 2 + * @copyright (c)1998-2009 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail fud...@li... + */ +package org.fudaa.fudaa.modeleur.modeleur1d.controller; + +/** + * Exception lev\xE9e quand quelque chose est annul\xE9 par l'utilisateur. + * @author Emmanuel MARTIN + * @version $Id:$ + */ +public class CancelException extends Exception { + public CancelException(String _message) { + super(_message); + } +} Property changes on: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/CancelException.java ___________________________________________________________________ Added: svn:keywords + Id Added: svn:eol-style + native Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-02-11 13:54:26 UTC (rev 4458) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-02-12 17:10:04 UTC (rev 4459) @@ -7,10 +7,9 @@ */ package org.fudaa.fudaa.modeleur.modeleur1d.controller; -import java.util.ArrayList; import java.util.Arrays; import java.util.BitSet; -import java.util.List; +import java.util.Map; import javax.swing.DefaultListSelectionModel; import javax.swing.event.ListSelectionListener; @@ -25,18 +24,17 @@ import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ebli.calque.BCalque; -import org.fudaa.ebli.calque.ZModeleLigneBrisee; import org.fudaa.ebli.calque.edition.ZModeleLigneBriseeEditable; import org.fudaa.fudaa.commun.FudaaLib; import org.fudaa.fudaa.modeleur.modeleur1d.model.Bief; import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainer; import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefContainerAdapter; import org.fudaa.fudaa.modeleur.modeleur1d.model.BiefSet; +import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsBief1d; import org.fudaa.fudaa.modeleur.modeleur1d.model.UtilsProfil1d; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueBief; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueFusionBief; import org.fudaa.fudaa.modeleur.modeleur1d.view.VueModuleGestionBief; -import org.fudaa.fudaa.sig.layer.FSigLayerLineEditable; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.CoordinateSequence; @@ -97,7 +95,7 @@ * l'indice pass\xE9 en param\xE8tre (-1 si inutilis\xE9). */ public int orderProfils(int _idx, CtuluCommandContainer _cmd) { - return biefSet_.getBief(biefSelectionModel_.getSelectedName()).orderProfils(_idx, _cmd); + return UtilsBief1d.orderProfils(biefSet_.getBief(biefSelectionModel_.getSelectedName()).profils_, _idx, _cmd); } /** @@ -108,36 +106,16 @@ return; int selectedValue=biefSelectionModel_.getMinSelectionIndex(); // Suppression des biefs pr\xE9c\xE9dents - String[] names=biefSet_.getBiefNames(); - for(int i=0;i<names.length;i++) - biefSet_.removeBief(names[i], null); - BCalque[] calques=_rootCalque.getCalques(); - // It\xE9ration du chaque bief - StringBuilder errors=new StringBuilder(); - for (int i=0; i<calques.length; i++) { - BCalque calqueBief=calques[i]; - List<ZModeleLigneBrisee> modelsDuFutureBief=new ArrayList<ZModeleLigneBrisee>(); - // Iteration sur chaque calque - BCalque[] sousCalques=calqueBief.getCalques(); - for (int j=0; j<sousCalques.length; j++) - if (sousCalques[j] instanceof FSigLayerLineEditable) - modelsDuFutureBief.add(((FSigLayerLineEditable)sousCalques[j]).getModele()); - // Ajout du bief - try { - biefSet_.addBief(calqueBief.getTitle(), modelsDuFutureBief.toArray(new ZModeleLigneBrisee[0]), null); - } - catch (IllegalArgumentException _exp) { - errors.append(FudaaLib.getS("Bief \"")+calqueBief.getTitle()+"\" : "+_exp.getMessage()+"\n"); - } - } + biefSet_.removeAllBiefs(null); + // Importation + Map<String, Bief> biefs=new BiefsImporterFromModeleur2d(_rootCalque).importAllBiefs(); + for(Map.Entry<String, Bief> entry:biefs.entrySet()) + biefSet_.addBief(entry.getKey(), entry.getValue(), null); // Ajout d'une selection if(biefSet_.getNbBief()>selectedValue&&selectedValue!=-1) biefSelectionModel_.addSelectionInterval(selectedValue, selectedValue); else if(biefSet_.getNbBief()>0&&selectedValue==-1) biefSelectionModel_.addSelectionInterval(0, 0); - // Traitement des erreurs - if(errors.length()>0) - throw new IllegalArgumentException(errors.toString()); } /** @@ -225,211 +203,226 @@ * Fusion de deux biefs. */ public void fusionnerBiefs(int _idxBief1, int _idxBief2){ - // D\xE9termine quel bief est le premier et lequel est le second (curvilignement parlant) - double bief1BaseCurv=0; - double bief2BaseCurv=0; - { // Bloque r\xE9duisant artificiellement la port\xE9 des variables + try { + // D\xE9termine quel bief est le premier et lequel est le second + // (curvilignement parlant) + double bief1BaseCurv=0; + double bief2BaseCurv=0; + { // Bloque r\xE9duisant artificiellement la port\xE9 des variables + String name1=biefSet_.getBiefName(_idxBief1); + String name2=biefSet_.getBiefName(_idxBief2); + Bief bief1=biefSet_.getBief(name1); + Bief bief2=biefSet_.getBief(name2); + + // Verifications + if (bief1==null||bief2==null) + throw new IllegalArgumentException(FudaaLib.getS("Au moins un des index ne correspond pas \xE0 un bief.")); + if (bief1.lignesDirectrices_.getNombre()!=bief2.lignesDirectrices_.getNombre()) + throw new IllegalArgumentException(FudaaLib + .getS("Il doit y avoir le m\xEAme nombre de lignes directrices dans les deux biefs.")); + if (bief1.axeHydraulique_.getNombre()!=bief2.axeHydraulique_.getNombre()) + throw new IllegalArgumentException(FudaaLib.getS("Les deux biefs doivent avoir la m\xEAme pr\xE9sence d'axe hydraulique.")); + + GISZoneCollection zoneAxeHydrau1=bief1.axeHydraulique_.getGeomData(); + if (zoneAxeHydrau1.getNumGeometries()>0) + bief1BaseCurv=(Double)zoneAxeHydrau1.getValue(zoneAxeHydrau1.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 0); + GISZoneCollection zoneAxeHydrau2=bief2.axeHydraulique_.getGeomData(); + if (zoneAxeHydrau2.getNumGeometries()>0) + bief2BaseCurv=(Double)zoneAxeHydrau2.getValue(zoneAxeHydrau2.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 0); + + // Inversion des biefs si n\xE9c\xE9ssaire + if (bief1BaseCurv>bief2BaseCurv) { + int idxTmp=_idxBief1; + _idxBief1=_idxBief2; + _idxBief2=idxTmp; + double valTmp=bief1BaseCurv; + bief1BaseCurv=bief2BaseCurv; + bief2BaseCurv=valTmp; + } + } + { // Bloque r\xE9duisant artificiellement la port\xE9 des variables + String name1=biefSet_.getBiefName(_idxBief1); + String name2=biefSet_.getBiefName(_idxBief2); + double bief1MaxCurvBrut; + double bief2MaxCurvBrut; + if (biefSet_.getBief(name1).axeHydraulique_.getGeomData().getNumGeometries()>0) { + CoordinateSequence seqAxe1=biefSet_.getBief(name1).axeHydraulique_.getGeomData().getCoordinateSequence(0); + bief1MaxCurvBrut=UtilsProfil1d.abscisseCurviligne(seqAxe1, seqAxe1.getCoordinate(seqAxe1.size()-1)); + CoordinateSequence seqAxe2=biefSet_.getBief(name2).axeHydraulique_.getGeomData().getCoordinateSequence(0); + bief2MaxCurvBrut=UtilsProfil1d.abscisseCurviligne(seqAxe2, seqAxe2.getCoordinate(seqAxe2.size()-1)); + } + else { + GISZoneCollection zone1=biefSet_.getBief(name1).profils_.getGeomData(); + bief1MaxCurvBrut=Double.parseDouble(((String)zone1.getValue(zone1.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), + zone1.getNumGeometries()-1)).substring(3)); + GISZoneCollection zone2=biefSet_.getBief(name2).profils_.getGeomData(); + bief2MaxCurvBrut=Double.parseDouble(((String)zone2.getValue(zone2.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), + zone2.getNumGeometries()-1)).substring(3)); + } + + if (bief1BaseCurv+bief1MaxCurvBrut>bief2BaseCurv) { + VueFusionBief vueFusionBief=new VueFusionBief(controller1d_.getFormater(), name1, bief1BaseCurv, bief1MaxCurvBrut, name2, + bief2BaseCurv, bief2MaxCurvBrut); + if (!vueFusionBief.run()) + return; + bief1BaseCurv=vueFusionBief.getAbsCurvAxe1(); + bief2BaseCurv=vueFusionBief.getAbsCurvAxe2(); + } + + // Inversion des biefs si n\xE9c\xE9ssaire + if (bief1BaseCurv>bief2BaseCurv) { + int idxTmp=_idxBief1; + _idxBief1=_idxBief2; + _idxBief2=idxTmp; + double valTmp=bief1BaseCurv; + bief1BaseCurv=bief2BaseCurv; + bief2BaseCurv=valTmp; + } + } + String name1=biefSet_.getBiefName(_idxBief1); String name2=biefSet_.getBiefName(_idxBief2); Bief bief1=biefSet_.getBief(name1); Bief bief2=biefSet_.getBief(name2); - - // Verifications - if(bief1==null||bief2==null) - throw new IllegalArgumentException(FudaaLib.getS("Au moins un des index ne correspond pas \xE0 un bief.")); - if(bief1.lignesDirectrices_.getNombre()!=bief2.lignesDirectrices_.getNombre()) - throw new IllegalArgumentException(FudaaLib.getS("Il doit y avoir le m\xEAme nombre de lignes directrices dans les deux biefs.")); - if(bief1.axeHydraulique_.getNombre()!=bief2.axeHydraulique_.getNombre()) - throw new IllegalArgumentException(FudaaLib.getS("Les deux biefs doivent avoir la m\xEAme pr\xE9sence d'axe hydraulique.")); - + // Extraction/Cr\xE9ation des axes hydrauliques GISZoneCollection zoneAxeHydrau1=bief1.axeHydraulique_.getGeomData(); - if(zoneAxeHydrau1.getNumGeometries()>0) - bief1BaseCurv=(Double)zoneAxeHydrau1.getValue(zoneAxeHydrau1.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 0); GISZoneCollection zoneAxeHydrau2=bief2.axeHydraulique_.getGeomData(); - if(zoneAxeHydrau2.getNumGeometries()>0) - bief2BaseCurv=(Double)zoneAxeHydrau2.getValue(zoneAxeHydrau2.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 0); - - // Inversion des biefs si n\xE9c\xE9ssaire - if (bief1BaseCurv>bief2BaseCurv) { - int idxTmp=_idxBief1; - _idxBief1=_idxBief2; - _idxBief2=idxTmp; - double valTmp=bief1BaseCurv; - bief1BaseCurv=bief2BaseCurv; - bief2BaseCurv=valTmp; + CoordinateSequence seqAxeHydraulique1; + CoordinateSequence seqAxeHydraulique2; + boolean fakeAH=false; + if (zoneAxeHydrau1.getNbGeometries()==0) { + fakeAH=true; + // Construction d'un faux axe hydraulique + if (bief1.profils_.getNombre()>=2) { + CoordinateSequence prof1=bief1.profils_.getGeomData().getCoordinateSequence(0); + CoordinateSequence prof2=bief1.profils_.getGeomData().getCoordinateSequence(bief1.profils_.getNombre()-1); + seqAxeHydraulique1=new GISCoordinateSequenceFactory().create(new Coordinate[]{prof1.getCoordinate(prof1.size()/2), + prof2.getCoordinate(prof2.size()/2)}); + } + else if (bief1.profils_.getNombre()==1) { + CoordinateSequence prof1=bief1.profils_.getGeomData().getCoordinateSequence(0); + Coordinate coord1=prof1.getCoordinate(prof1.size()/2); + Coordinate coord2=new Coordinate(coord1.x-10, coord1.y-1, 0); + seqAxeHydraulique1=new GISCoordinateSequenceFactory().create(new Coordinate[]{coord1, coord2}); + } + else + return; + if (bief2.profils_.getNombre()>=2) { + CoordinateSequence prof1=bief2.profils_.getGeomData().getCoordinateSequence(0); + CoordinateSequence prof2=bief2.profils_.getGeomData().getCoordinateSequence(bief2.profils_.getNombre()-1); + seqAxeHydraulique2=new GISCoordinateSequenceFactory().create(new Coordinate[]{prof1.getCoordinate(prof1.size()/2), + prof2.getCoordinate(prof2.size()/2)}); + } + else if (bief2.profils_.getNombre()==1) { + CoordinateSequence prof1=bief2.profils_.getGeomData().getCoordinateSequence(0); + Coordinate coord1=prof1.getCoordinate(prof1.size()/2); + Coordinate coord2=new Coordinate(coord1.x-10, coord1.y-1, 0); + seqAxeHydraulique2=new GISCoordinateSequenceFactory().create(new Coordinate[]{coord1, coord2}); + } + else + return; } - } - { // Bloque r\xE9duisant artificiellement la port\xE9 des variables - String name1=biefSet_.getBiefName(_idxBief1); - String name2=biefSet_.getBiefName(_idxBief2); - double bief1MaxCurvBrut; - double bief2MaxCurvBrut; - if(biefSet_.getBief(name1).axeHydraulique_.getGeomData().getNumGeometries()>0) { - CoordinateSequence seqAxe1=biefSet_.getBief(name1).axeHydraulique_.getGeomData().getCoordinateSequence(0); - bief1MaxCurvBrut=UtilsProfil1d.abscisseCurviligne(seqAxe1, seqAxe1.getCoordinate(seqAxe1.size()-1)); - CoordinateSequence seqAxe2=biefSet_.getBief(name2).axeHydraulique_.getGeomData().getCoordinateSequence(0); - bief2MaxCurvBrut=UtilsProfil1d.abscisseCurviligne(seqAxe2, seqAxe2.getCoordinate(seqAxe2.size()-1)); - } else { - GISZoneCollection zone1=biefSet_.getBief(name1).profils_.getGeomData(); - bief1MaxCurvBrut=Double.parseDouble(((String) zone1.getValue(zone1.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), zone1.getNumGeometries()-1)).substring(3)); - GISZoneCollection zone2=biefSet_.getBief(name2).profils_.getGeomData(); - bief2MaxCurvBrut=Double.parseDouble(((String) zone2.getValue(zone2.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), zone2.getNumGeometries()-1)).substring(3)); + seqAxeHydraulique1=zoneAxeHydrau1.getCoordinateSequence(0); + seqAxeHydraulique2=zoneAxeHydrau2.getCoordinateSequence(0); } - - if(bief1BaseCurv+bief1MaxCurvBrut>bief2BaseCurv) { - VueFusionBief vueFusionBief=new VueFusionBief(controller1d_.getFormater(), name1, bief1BaseCurv, bief1MaxCurvBrut, name2, bief2BaseCurv, bief2MaxCurvBrut); - if(!vueFusionBief.run()) - return; - bief1BaseCurv=vueFusionBief.getAbsCurvAxe1(); - bief2BaseCurv=vueFusionBief.getAbsCurvAxe2(); + + Coordinate debutAxe2=UtilsProfil1d.getCoordinateXY(seqAxeHydraulique1, bief2BaseCurv-bief1BaseCurv); + Coordinate move=UtilsProfil1d.vec(seqAxeHydraulique2.getCoordinate(0), debutAxe2); + + // Construction du nouveau bief + Bief newBief=new Bief(); + String biefName=name1+"_"+name2; + int k=1; + while (biefSet_.getBief(biefName)!=null) + biefName=name1+"_"+name2+"#"+Integer.toString(++k); + // Racourcis + GISZoneCollection zoneAxeHydraulique=newBief.axeHydraulique_.getGeomData(); + GISZoneCollection zoneProfils=newBief.profils_.getGeomData(); + GISZoneCollection bief1ZoneProfil=bief1.profils_.getGeomData(); + GISZoneCollection bief2ZoneProfil=bief2.profils_.getGeomData(); + + // Ajout de g\xE9om\xE9tries au nouveau bief \\ + // Ajout des profils des biefs d'origines + int idxAttrComm=zoneProfils.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + for (int i=0; i<bief1.profils_.getNombre(); i++) { + int idxGeom=zoneProfils.addGeometry(bief1ZoneProfil.getGeometry(i), UtilsProfil1d.getData(i, bief1ZoneProfil), null); + if (fakeAH) { + // Dans le cas de l'utilisation de l'attribut CommentaireHydro, on + // r\xE9percute le changement de baseCurv sur les valeurs de l'attribut + String comm=(String)zoneProfils.getValue(idxAttrComm, idxGeom); + double newPK=GISLib.getHydroCommentDouble(comm, "PK")+bief1BaseCurv; + String newValue=GISLib.setHydroCommentDouble(comm, newPK, "PK"); + zoneProfils.setAttributValue(idxAttrComm, idxGeom, newValue, null); + } } - - // Inversion des biefs si n\xE9c\xE9ssaire - if (bief1BaseCurv>bief2BaseCurv) { - int idxTmp=_idxBief1; - _idxBief1=_idxBief2; - _idxBief2=idxTmp; - double valTmp=bief1BaseCurv; - bief1BaseCurv=bief2BaseCurv; - bief2BaseCurv=valTmp; + for (int i=0; i<bief2.profils_.getNombre(); i++) { + int idxGeom=zoneProfils.addGeometry(bief2ZoneProfil.getGeometry(i), UtilsProfil1d.getData(i, bief2ZoneProfil), null); + if (fakeAH) { + // Dans le cas de l'utilisation de l'attribut CommentaireHydro, on + // r\xE9percute le changement de baseCurv sur les valeurs de l'attribut + String comm=(String)zoneProfils.getValue(idxAttrComm, idxGeom); + double newPK=GISLib.getHydroCommentDouble(comm, "PK")+bief2BaseCurv; + String newValue=GISLib.setHydroCommentDouble(comm, newPK, "PK"); + zoneProfils.setAttributValue(idxAttrComm, idxGeom, newValue, null); + } } - } - - String name1=biefSet_.getBiefName(_idxBief1); - String name2=biefSet_.getBiefName(_idxBief2); - Bief bief1=biefSet_.getBief(name1); - Bief bief2=biefSet_.getBief(name2); - // Extraction/Cr\xE9ation des axes hydrauliques - GISZoneCollection zoneAxeHydrau1=bief1.axeHydraulique_.getGeomData(); - GISZoneCollection zoneAxeHydrau2=bief2.axeHydraulique_.getGeomData(); - CoordinateSequence seqAxeHydraulique1; - CoordinateSequence seqAxeHydraulique2; - boolean fakeAH=false; - if(zoneAxeHydrau1.getNbGeometries()==0) { - fakeAH=true; - // Construction d'un faux axe hydraulique - if(bief1.profils_.getNombre()>=2) { - CoordinateSequence prof1=bief1.profils_.getGeomData().getCoordinateSequence(0); - CoordinateSequence prof2=bief1.profils_.getGeomData().getCoordinateSequence(bief1.profils_.getNombre()-1); - seqAxeHydraulique1=new GISCoordinateSequenceFactory().create(new Coordinate[]{prof1.getCoordinate(prof1.size()/2), prof2.getCoordinate(prof2.size()/2)}); + // Ajout de l'axe hydraulique du second bief (utile pour la translation) + if (!fakeAH) + zoneAxeHydraulique.addGeometry(zoneAxeHydrau2.getGeometry(0), UtilsProfil1d.getData(0, zoneAxeHydrau2), null); + + // Translation du second bief \\ + // Cr\xE9ation d'une selection contenant le second axe hydraulique + if (!fakeAH) { + BitSet bs=new BitSet(1); + bs.set(0); + CtuluListSelection selection=new CtuluListSelection(bs); + // Application de la translation sur le second axe hydraulique + ((ZModeleLigneBriseeEditable)newBief.axeHydraulique_).moveGlobal(selection, move.x, move.y, 0, null); } - else if(bief1.profils_.getNombre()==1) { - CoordinateSequence prof1=bief1.profils_.getGeomData().getCoordinateSequence(0); - Coordinate coord1=prof1.getCoordinate(prof1.size()/2); - Coordinate coord2=new Coordinate(coord1.x-10, coord1.y-1, 0); - seqAxeHydraulique1=new GISCoordinateSequenceFactory().create(new Coordinate[]{coord1, coord2}); - } - else - return; - if(bief2.profils_.getNombre()>=2) { - CoordinateSequence prof1=bief2.profils_.getGeomData().getCoordinateSequence(0); - CoordinateSequence prof2=bief2.profils_.getGeomData().getCoordinateSequence(bief2.profils_.getNombre()-1); - seqAxeHydraulique2=new GISCoordinateSequenceFactory().create(new Coordinate[]{prof1.getCoordinate(prof1.size()/2), prof2.getCoordinate(prof2.size()/2)}); - } - else if(bief2.profils_.getNombre()==1) { - CoordinateSequence prof1=bief2.profils_.getGeomData().getCoordinateSequence(0); - Coordinate coord1=prof1.getCoordinate(prof1.size()/2); - Coordinate coord2=new Coordinate(coord1.x-10, coord1.y-1, 0); - seqAxeHydraulique2=new GISCoordinateSequenceFactory().create(new Coordinate[]{coord1, coord2}); - } - else - return; - } - else { - seqAxeHydraulique1=zoneAxeHydrau1.getCoordinateSequence(0); - seqAxeHydraulique2=zoneAxeHydrau2.getCoordinateSequence(0); - } - - Coordinate debutAxe2=UtilsProfil1d.getCoordinateXY(seqAxeHydraulique1, bief2BaseCurv-bief1BaseCurv); - Coordinate move=UtilsProfil1d.vec(seqAxeHydraulique2.getCoordinate(0), debutAxe2); - - // Construction du nouveau bief - Bief newBief=new Bief(); - String biefName=name1+"_"+name2; - int k=1; - while(biefSet_.getBief(biefName)!=null) - biefName=name1+"_"+name2+"#"+Integer.toString(++k); - // Racourcis - GISZoneCollection zoneAxeHydraulique=newBief.axeHydraulique_.getGeomData(); - GISZoneCollection zoneProfils=newBief.profils_.getGeomData(); - GISZoneCollection bief1ZoneProfil=bief1.profils_.getGeomData(); - GISZoneCollection bief2ZoneProfil=bief2.profils_.getGeomData(); - - // Ajout de g\xE9om\xE9tries au nouveau bief \\ - // Ajout des profils des biefs d'origines - int idxAttrComm=zoneProfils.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); - for(int i=0;i<bief1.profils_.getNombre();i++) { - int idxGeom=zoneProfils.addGeometry(bief1ZoneProfil.getGeometry(i), UtilsProfil1d.getData(i, bief1ZoneProfil), null); - if (fakeAH) { - // Dans le cas de l'utilisation de l'attribut CommentaireHydro, on - // r\xE9percute le changement de baseCurv sur les valeurs de l'attribut - String comm=(String)zoneProfils.getValue(idxAttrComm, idxGeom); - double newPK=GISLib.getHydroCommentDouble(comm, "PK")+bief1BaseCurv; - String newValue=GISLib.setHydroCommentDouble(comm, newPK, "PK"); - zoneProfils.setAttributValue(idxAttrComm, i, newValue, null); - } - } - for(int i=0;i<bief2.profils_.getNombre();i++) { - int idxGeom=zoneProfils.addGeometry(bief2ZoneProfil.getGeometry(i), UtilsProfil1d.getData(i, bief2ZoneProfil), null); - if (fakeAH) { - // Dans le cas de l'utilisation de l'attribut CommentaireHydro, on - // r\xE9percute le changement de baseCurv sur les valeurs de l'attribut - String comm=(String)zoneProfils.getValue(idxAttrComm, idxGeom); - double newPK=GISLib.getHydroCommentDouble(comm, "PK")+bief1BaseCurv; - String newValue=GISLib.setHydroCommentDouble(comm, newPK, "PK"); - zoneProfils.setAttributValue(idxAttrComm, i, newValue, null); - } - } - // Ajout de l'axe hydraulique du second bief (utile pour la translation) - if(!fakeAH) - zoneAxeHydraulique.addGeometry(zoneAxeHydrau2.getGeometry(0), Utils... [truncated message content] |
From: <bma...@us...> - 2009-02-11 13:54:37
|
Revision: 4458 http://fudaa.svn.sourceforge.net/fudaa/?rev=4458&view=rev Author: bmarchan Date: 2009-02-11 13:54:26 +0000 (Wed, 11 Feb 2009) Log Message: ----------- Chgt tol?\195?\169rance pour simplification en 1D. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-11 13:50:05 UTC (rev 4457) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-11 13:54:26 UTC (rev 4458) @@ -106,7 +106,7 @@ * rupture. La valeur est l'angle maximal au dela duquel il sera lin\xE9aris\xE9. * Il est en radian. */ - static final double _tolerance=Math.PI-Math.PI/6; + static final double _tolerance=Math.PI-0.0001;//Math.PI/6; /** Le biefContainer contenant le bief contenant les profils utilis\xE9s. */ private BiefContainer biefContainer_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2009-02-11 13:50:09
|
Revision: 4457 http://fudaa.svn.sourceforge.net/fudaa/?rev=4457&view=rev Author: bmarchan Date: 2009-02-11 13:50:05 +0000 (Wed, 11 Feb 2009) Log Message: ----------- Nouveau format SinusX suite. Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrMatisseConvertGUI.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrMatisseConvertGUI.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrMatisseConvertGUI.java 2009-02-11 11:48:56 UTC (rev 4456) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/tr/telemac/TrMatisseConvertGUI.java 2009-02-11 13:50:05 UTC (rev 4457) @@ -42,7 +42,7 @@ import org.fudaa.dodico.commun.DodicoLib; import org.fudaa.dodico.telemac.io.MatisseReader; import org.fudaa.dodico.telemac.io.SinusxFileFormat; -import org.fudaa.dodico.telemac.io.SinusxWriter; +import org.fudaa.dodico.telemac.io.SinusxWriterAbstract; import org.fudaa.ebli.commun.EbliLib; @@ -239,7 +239,7 @@ } btStop_.setEnabled(true); progress_.setDesc(CtuluLib.getS("Export")); - final SinusxWriter sxW = new SinusxWriter(SinusxFileFormat.getInstance()); + final SinusxWriterAbstract sxW = SinusxFileFormat.getInstance().createWriter(); current_ = sxW; //# Conversion de la GISZone en GISDataModel[][] #\\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emm...@us...> - 2009-02-11 13:22:26
|
Revision: 4456 http://fudaa.svn.sourceforge.net/fudaa/?rev=4456&view=rev Author: emmanuel_martin Date: 2009-02-11 11:48:56 +0000 (Wed, 11 Feb 2009) Log Message: ----------- Impl?\195?\169mentation partielle de la tache #178 : "Utilisation du PK des profils 2D rubar dans le modeleur 1D" Modified Paths: -------------- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionAxeHydraulique.java branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java 2009-02-11 10:57:27 UTC (rev 4455) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISLib.java 2009-02-11 11:48:56 UTC (rev 4456) @@ -806,6 +806,67 @@ return GISGeometryFactory.INSTANCE.createLinearRing(seq); } + /** + * Retourne la valeur pour une propri\xE9t\xE9 hydraulique de type double. + * @param _comm Commentaire hydro sous la forme "<prop1>=<val>; <prop2>=<val>" + * @param _prop La propri\xE9t\xE9 a extraire. + * @return La valeur de la propri\xE9t\xE9. + */ + static public double getHydroCommentDouble(String _comm, String _prop) { + double r=0; + + if (_comm!=null && !_comm.trim().equals("")) { + for (String cpl : _comm.split(";")) { + String[] nameval=cpl.split("="); + if (nameval.length==2 && nameval[0].equalsIgnoreCase(_prop)) { + try { + r=Double.parseDouble(nameval[1]); + break; + } + // En cas d'erreur, retourne 0. + catch (NumberFormatException _exc) {} + } + } + } + return r; + } + /** + * Retourne vrai si la propri\xE9t\xE9 est valu\xE9e. + */ + static public boolean isHydroCommentValued(final String _comm, String _prop) { + if (_comm!=null&&!_comm.trim().equals("")) + for (String cpl : _comm.split(";")) { + String[] nameval=cpl.split("="); + if (nameval.length==2&&nameval[0].equalsIgnoreCase(_prop)) + return true; + } + return false; + } + /** + * Retourne une nouvelle instance de commentaire ayant pour nouvelle valeur de '_prop' '_value'. + * @param _comm Commentaire hydro sous la forme "<prop1>=<val>; <prop2>=<val>" + * @param _prop La propri\xE9t\xE9. + * @param _value la nouvelle valeur pour prop. + * @return Nouvelle instance du commentaire. + */ + static public String setHydroCommentDouble(final String _comm, double _value, String _prop) { + StringBuilder str=new StringBuilder(); + boolean found=false; + if (_comm!=null && !_comm.trim().equals("")) { + for (String cpl : _comm.split(";")) { + String[] nameval=cpl.split("="); + if (nameval.length==2 && nameval[0].equalsIgnoreCase(_prop)) { + found=true; + str.append(nameval[0]+"="+Double.toString(_value)); + } + else + str.append(cpl); + } + } + if(!found) + str.append(_prop+"="+_value); + return str.toString(); + } } \ No newline at end of file Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java 2009-02-11 10:57:27 UTC (rev 4455) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/dodico/src/org/fudaa/dodico/rubar/io/RubarStWriter.java 2009-02-11 11:48:56 UTC (rev 4456) @@ -20,6 +20,7 @@ import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISDataModel; import org.fudaa.ctulu.gis.GISDataModelFilterAdapter; +import org.fudaa.ctulu.gis.GISLib; import org.fudaa.dodico.fortran.FileOpWriterCharSimpleAbstract; import org.fudaa.dodico.fortran.FortranWriter; @@ -46,31 +47,6 @@ isSt_ = !_f.getName().toLowerCase().endsWith(".cn"); super.setFile(_f); } - - /** - * Retourne la valeur pour une propri\xE9t\xE9 hydraulique de type double. - * @param _comm Commentaire hydro sous la forme "<prop1>=<val>; <prop2>=<val>" - * @param _prop La propri\xE9t\xE9 a extraire. - * @return La valeur de la propri\xE9t\xE9. - */ - private double getHydroCommentDouble(String _comm, String _prop) { - double r=0; - - if (_comm!=null && !_comm.trim().equals("")) { - for (String cpl : _comm.split(";")) { - String[] nameval=cpl.split("="); - if (nameval.length==2 && nameval[0].equalsIgnoreCase(_prop)) { - try { - r=Double.parseDouble(nameval[1]); - break; - } - // En cas d'erreur, retourne 0. - catch (NumberFormatException _exc) {} - } - } - } - return r; - } /** * Ecrit les profils et les lignes directrices. @@ -113,7 +89,7 @@ if (attName==-1||(name=(String)profs_.getValue(attName, i))==null) name=""; // PK, issu du commentaire hydrualique. if (attPk!=-1) { - pk=getHydroCommentDouble((String)profs_.getValue(attPk, i),RubarStCnFileFormat.COMM_HYDRO_PK); + pk=GISLib.getHydroCommentDouble((String)profs_.getValue(attPk, i),RubarStCnFileFormat.COMM_HYDRO_PK); } writer.setSpaceBefore(false); writer.stringField(6, name); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2009-02-11 10:57:27 UTC (rev 4455) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/ebli/src/org/fudaa/ebli/calque/ZScene.java 2009-02-11 11:48:56 UTC (rev 4456) @@ -186,14 +186,15 @@ for (int i=0; i<cqs.length; i++) { if (cqs[i].getLayerSelection()!=null) { int[] isels=cqs[i].getLayerSelection().getSelectedIndex(); - if (isels!=null){ - for (int j=0; j<isels.length; j++) isels[j]+=idecal; + if (isels!=null) { + for (int j=0; j<isels.length; j++) + isels[j]+=idecal; System.arraycopy(isels, 0, iglobsels, ipt, isels.length); ipt+=isels.length; } - if(cqs[i].modeleDonnees()!=null) - idecal+=cqs[i].modeleDonnees().getNombre(); } + if (cqs[i].modeleDonnees()!=null) + idecal+=cqs[i].modeleDonnees().getNombre(); } // for (int i=0; i<lists_.length-1; i++) { // int[] isels=lists_[i].getSelectedIndex(); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-02-11 10:57:27 UTC (rev 4455) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/controller/ControllerBief.java 2009-02-11 11:48:56 UTC (rev 4456) @@ -21,6 +21,7 @@ import org.fudaa.ctulu.CtuluListSelection; import org.fudaa.ctulu.gis.GISAttributeConstants; import org.fudaa.ctulu.gis.GISCoordinateSequenceFactory; +import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ebli.calque.BCalque; @@ -224,25 +225,30 @@ * Fusion de deux biefs. */ public void fusionnerBiefs(int _idxBief1, int _idxBief2){ - // D\xE9termine le premier axe hydraulique et le second - double bief1BaseCurv; - double bief2BaseCurv; + // D\xE9termine quel bief est le premier et lequel est le second (curvilignement parlant) + double bief1BaseCurv=0; + double bief2BaseCurv=0; { // Bloque r\xE9duisant artificiellement la port\xE9 des variables String name1=biefSet_.getBiefName(_idxBief1); String name2=biefSet_.getBiefName(_idxBief2); Bief bief1=biefSet_.getBief(name1); Bief bief2=biefSet_.getBief(name2); - GISZoneCollection zoneAxeHydrau1=bief1.axeHydraulique_.getGeomData(); - bief1BaseCurv=(Double)zoneAxeHydrau1.getValue(zoneAxeHydrau1.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 0); - GISZoneCollection zoneAxeHydrau2=bief2.axeHydraulique_.getGeomData(); - bief2BaseCurv=(Double)zoneAxeHydrau2.getValue(zoneAxeHydrau2.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 0); - + // Verifications if(bief1==null||bief2==null) throw new IllegalArgumentException(FudaaLib.getS("Au moins un des index ne correspond pas \xE0 un bief.")); if(bief1.lignesDirectrices_.getNombre()!=bief2.lignesDirectrices_.getNombre()) throw new IllegalArgumentException(FudaaLib.getS("Il doit y avoir le m\xEAme nombre de lignes directrices dans les deux biefs.")); + if(bief1.axeHydraulique_.getNombre()!=bief2.axeHydraulique_.getNombre()) + throw new IllegalArgumentException(FudaaLib.getS("Les deux biefs doivent avoir la m\xEAme pr\xE9sence d'axe hydraulique.")); + GISZoneCollection zoneAxeHydrau1=bief1.axeHydraulique_.getGeomData(); + if(zoneAxeHydrau1.getNumGeometries()>0) + bief1BaseCurv=(Double)zoneAxeHydrau1.getValue(zoneAxeHydrau1.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 0); + GISZoneCollection zoneAxeHydrau2=bief2.axeHydraulique_.getGeomData(); + if(zoneAxeHydrau2.getNumGeometries()>0) + bief2BaseCurv=(Double)zoneAxeHydrau2.getValue(zoneAxeHydrau2.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 0); + // Inversion des biefs si n\xE9c\xE9ssaire if (bief1BaseCurv>bief2BaseCurv) { int idxTmp=_idxBief1; @@ -256,10 +262,20 @@ { // Bloque r\xE9duisant artificiellement la port\xE9 des variables String name1=biefSet_.getBiefName(_idxBief1); String name2=biefSet_.getBiefName(_idxBief2); - CoordinateSequence seqAxe1=biefSet_.getBief(name1).axeHydraulique_.getGeomData().getCoordinateSequence(0); - CoordinateSequence seqAxe2=biefSet_.getBief(name2).axeHydraulique_.getGeomData().getCoordinateSequence(0); - double bief1MaxCurvBrut=UtilsProfil1d.abscisseCurviligne(seqAxe1, seqAxe1.getCoordinate(seqAxe1.size()-1)); - double bief2MaxCurvBrut=UtilsProfil1d.abscisseCurviligne(seqAxe2, seqAxe2.getCoordinate(seqAxe2.size()-1)); + double bief1MaxCurvBrut; + double bief2MaxCurvBrut; + if(biefSet_.getBief(name1).axeHydraulique_.getGeomData().getNumGeometries()>0) { + CoordinateSequence seqAxe1=biefSet_.getBief(name1).axeHydraulique_.getGeomData().getCoordinateSequence(0); + bief1MaxCurvBrut=UtilsProfil1d.abscisseCurviligne(seqAxe1, seqAxe1.getCoordinate(seqAxe1.size()-1)); + CoordinateSequence seqAxe2=biefSet_.getBief(name2).axeHydraulique_.getGeomData().getCoordinateSequence(0); + bief2MaxCurvBrut=UtilsProfil1d.abscisseCurviligne(seqAxe2, seqAxe2.getCoordinate(seqAxe2.size()-1)); + } + else { + GISZoneCollection zone1=biefSet_.getBief(name1).profils_.getGeomData(); + bief1MaxCurvBrut=Double.parseDouble(((String) zone1.getValue(zone1.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), zone1.getNumGeometries()-1)).substring(3)); + GISZoneCollection zone2=biefSet_.getBief(name2).profils_.getGeomData(); + bief2MaxCurvBrut=Double.parseDouble(((String) zone2.getValue(zone2.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), zone2.getNumGeometries()-1)).substring(3)); + } if(bief1BaseCurv+bief1MaxCurvBrut>bief2BaseCurv) { VueFusionBief vueFusionBief=new VueFusionBief(controller1d_.getFormater(), name1, bief1BaseCurv, bief1MaxCurvBrut, name2, bief2BaseCurv, bief2MaxCurvBrut); @@ -279,15 +295,51 @@ bief2BaseCurv=valTmp; } } - + String name1=biefSet_.getBiefName(_idxBief1); String name2=biefSet_.getBiefName(_idxBief2); Bief bief1=biefSet_.getBief(name1); Bief bief2=biefSet_.getBief(name2); + // Extraction/Cr\xE9ation des axes hydrauliques GISZoneCollection zoneAxeHydrau1=bief1.axeHydraulique_.getGeomData(); GISZoneCollection zoneAxeHydrau2=bief2.axeHydraulique_.getGeomData(); - CoordinateSequence seqAxeHydraulique1=zoneAxeHydrau1.getCoordinateSequence(0); - CoordinateSequence seqAxeHydraulique2=zoneAxeHydrau2.getCoordinateSequence(0); + CoordinateSequence seqAxeHydraulique1; + CoordinateSequence seqAxeHydraulique2; + boolean fakeAH=false; + if(zoneAxeHydrau1.getNbGeometries()==0) { + fakeAH=true; + // Construction d'un faux axe hydraulique + if(bief1.profils_.getNombre()>=2) { + CoordinateSequence prof1=bief1.profils_.getGeomData().getCoordinateSequence(0); + CoordinateSequence prof2=bief1.profils_.getGeomData().getCoordinateSequence(bief1.profils_.getNombre()-1); + seqAxeHydraulique1=new GISCoordinateSequenceFactory().create(new Coordinate[]{prof1.getCoordinate(prof1.size()/2), prof2.getCoordinate(prof2.size()/2)}); + } + else if(bief1.profils_.getNombre()==1) { + CoordinateSequence prof1=bief1.profils_.getGeomData().getCoordinateSequence(0); + Coordinate coord1=prof1.getCoordinate(prof1.size()/2); + Coordinate coord2=new Coordinate(coord1.x-10, coord1.y-1, 0); + seqAxeHydraulique1=new GISCoordinateSequenceFactory().create(new Coordinate[]{coord1, coord2}); + } + else + return; + if(bief2.profils_.getNombre()>=2) { + CoordinateSequence prof1=bief2.profils_.getGeomData().getCoordinateSequence(0); + CoordinateSequence prof2=bief2.profils_.getGeomData().getCoordinateSequence(bief2.profils_.getNombre()-1); + seqAxeHydraulique2=new GISCoordinateSequenceFactory().create(new Coordinate[]{prof1.getCoordinate(prof1.size()/2), prof2.getCoordinate(prof2.size()/2)}); + } + else if(bief2.profils_.getNombre()==1) { + CoordinateSequence prof1=bief2.profils_.getGeomData().getCoordinateSequence(0); + Coordinate coord1=prof1.getCoordinate(prof1.size()/2); + Coordinate coord2=new Coordinate(coord1.x-10, coord1.y-1, 0); + seqAxeHydraulique2=new GISCoordinateSequenceFactory().create(new Coordinate[]{coord1, coord2}); + } + else + return; + } + else { + seqAxeHydraulique1=zoneAxeHydrau1.getCoordinateSequence(0); + seqAxeHydraulique2=zoneAxeHydrau2.getCoordinateSequence(0); + } Coordinate debutAxe2=UtilsProfil1d.getCoordinateXY(seqAxeHydraulique1, bief2BaseCurv-bief1BaseCurv); Coordinate move=UtilsProfil1d.vec(seqAxeHydraulique2.getCoordinate(0), debutAxe2); @@ -306,41 +358,66 @@ // Ajout de g\xE9om\xE9tries au nouveau bief \\ // Ajout des profils des biefs d'origines - for(int i=0;i<bief1.profils_.getNombre();i++) - zoneProfils.addGeometry(bief1ZoneProfil.getGeometry(i), UtilsProfil1d.getData(i, bief1ZoneProfil), null); - for(int i=0;i<bief2.profils_.getNombre();i++) - zoneProfils.addGeometry(bief2ZoneProfil.getGeometry(i), UtilsProfil1d.getData(i, bief2ZoneProfil), null); + int idxAttrComm=zoneProfils.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + for(int i=0;i<bief1.profils_.getNombre();i++) { + int idxGeom=zoneProfils.addGeometry(bief1ZoneProfil.getGeometry(i), UtilsProfil1d.getData(i, bief1ZoneProfil), null); + if (fakeAH) { + // Dans le cas de l'utilisation de l'attribut CommentaireHydro, on + // r\xE9percute le changement de baseCurv sur les valeurs de l'attribut + String comm=(String)zoneProfils.getValue(idxAttrComm, idxGeom); + double newPK=GISLib.getHydroCommentDouble(comm, "PK")+bief1BaseCurv; + String newValue=GISLib.setHydroCommentDouble(comm, newPK, "PK"); + zoneProfils.setAttributValue(idxAttrComm, i, newValue, null); + } + } + for(int i=0;i<bief2.profils_.getNombre();i++) { + int idxGeom=zoneProfils.addGeometry(bief2ZoneProfil.getGeometry(i), UtilsProfil1d.getData(i, bief2ZoneProfil), null); + if (fakeAH) { + // Dans le cas de l'utilisation de l'attribut CommentaireHydro, on + // r\xE9percute le changement de baseCurv sur les valeurs de l'attribut + String comm=(String)zoneProfils.getValue(idxAttrComm, idxGeom); + double newPK=GISLib.getHydroCommentDouble(comm, "PK")+bief1BaseCurv; + String newValue=GISLib.setHydroCommentDouble(comm, newPK, "PK"); + zoneProfils.setAttributValue(idxAttrComm, i, newValue, null); + } + } // Ajout de l'axe hydraulique du second bief (utile pour la translation) - zoneAxeHydraulique.addGeometry(zoneAxeHydrau2.getGeometry(0), UtilsProfil1d.getData(0, zoneAxeHydrau2), null); + if(!fakeAH) + zoneAxeHydraulique.addGeometry(zoneAxeHydrau2.getGeometry(0), UtilsProfil1d.getData(0, zoneAxeHydrau2), null); // Translation du second bief \\ // Cr\xE9ation d'une selection contenant le second axe hydraulique - BitSet bs=new BitSet(1); - bs.set(0); - CtuluListSelection selection=new CtuluListSelection(bs); - // Application de la translation sur le second axe hydraulique - ((ZModeleLigneBriseeEditable) newBief.axeHydraulique_).moveGlobal(selection, move.x, move.y, 0, null); + if (!fakeAH) { + BitSet bs=new BitSet(1); + bs.set(0); + CtuluListSelection selection=new CtuluListSelection(bs); + // Application de la translation sur le second axe hydraulique + ((ZModeleLigneBriseeEditable)newBief.axeHydraulique_).moveGlobal(selection, move.x, move.y, 0, null); + } // Cr\xE9ation d'une selection contenant les profils du second axe hydraulique - bs=new BitSet(zoneProfils.getNbGeometries()); + BitSet bs=new BitSet(zoneProfils.getNbGeometries()); bs.set(bief1.profils_.getNombre(), zoneProfils.getNbGeometries()); - selection=new CtuluListSelection(bs); + CtuluListSelection selection=new CtuluListSelection(bs); // Application de la translation sur les profils du second axe hydraulique ((ZModeleLigneBriseeEditable) newBief.profils_).moveGlobal(selection, move.x, move.y, 0, null); // Fusion des deux axes Hydrauliques \\ - String newTitre=agregeTitres(0, zoneAxeHydrau1, zoneAxeHydrau2, -1, -1); - seqAxeHydraulique2=zoneAxeHydraulique.getCoordinateSequence(0); - Coordinate[] coords=new Coordinate[seqAxeHydraulique1.size()+seqAxeHydraulique2.size()]; - int i=0; - for(;i<seqAxeHydraulique1.size();i++) - coords[i]=seqAxeHydraulique1.getCoordinate(i); - for(;i<seqAxeHydraulique2.size()+seqAxeHydraulique1.size();i++) - coords[i]=seqAxeHydraulique2.getCoordinate(i-seqAxeHydraulique1.size()); - zoneAxeHydraulique.addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(coords)), null, null); - zoneAxeHydraulique.setAttributValue(zoneAxeHydraulique.getIndiceOf(GISAttributeConstants.TITRE), 1, newTitre, null); - zoneAxeHydraulique.setAttributValue(zoneAxeHydrau1.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 1, bief1BaseCurv, null); - // suppression de l'axe hydraulique 2 du nouveau bief - zoneAxeHydraulique.removeGeometries(new int[]{0}, null); + if (!fakeAH) { + String newTitre=agregeTitres(0, zoneAxeHydrau1, zoneAxeHydrau2, -1, -1); + seqAxeHydraulique2=zoneAxeHydraulique.getCoordinateSequence(0); + Coordinate[] coords=new Coordinate[seqAxeHydraulique1.size()+seqAxeHydraulique2.size()]; + int i=0; + for (; i<seqAxeHydraulique1.size(); i++) + coords[i]=seqAxeHydraulique1.getCoordinate(i); + for (; i<seqAxeHydraulique2.size()+seqAxeHydraulique1.size(); i++) + coords[i]=seqAxeHydraulique2.getCoordinate(i-seqAxeHydraulique1.size()); + zoneAxeHydraulique.addGeometry(new GISPolyligne(new GISCoordinateSequenceFactory().create(coords)), null, null); + zoneAxeHydraulique.setAttributValue(zoneAxeHydraulique.getIndiceOf(GISAttributeConstants.TITRE), 1, newTitre, null); + zoneAxeHydraulique.setAttributValue(zoneAxeHydrau1.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE), 1, bief1BaseCurv, + null); + // suppression de l'axe hydraulique 2 du nouveau bief + zoneAxeHydraulique.removeGeometries(new int[]{0}, null); + } // Traitement des g\xE9om\xE9tries volatiles \\ // Rives Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-02-11 10:57:27 UTC (rev 4455) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/Bief.java 2009-02-11 11:48:56 UTC (rev 4456) @@ -22,6 +22,7 @@ import org.fudaa.ctulu.gis.GISAttributeModelIntegerList; import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISCoordinateSequenceFactory; +import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ctulu.gis.GISPolyligne; import org.fudaa.ctulu.gis.GISReprojectInterpolateur1DDouble; import org.fudaa.ctulu.gis.GISZoneCollection; @@ -120,10 +121,6 @@ if (nature==GISAttributeConstants.ATT_NATURE_AH) if (axeHydraulique_!=null) throw new IllegalArgumentException(FudaaLib.getS("Plusieurs models d'axe hydrauliques sont donn\xE9es.")); - else if (_models[i].getGeomData().getNbGeometries()>1) - throw new IllegalArgumentException(FudaaLib.getS("Il ne peut pas y avoir plusieurs axes hydrauliques dans le bief.")); - else if (_models[i].getGeomData().getNbGeometries()==0) - throw new IllegalArgumentException(FudaaLib.getS("Il doit y avoir au moins un axe hydraulique dans le bief.")); else axeHydraulique_=_models[i]; else if (nature==GISAttributeConstants.ATT_NATURE_LD) @@ -182,47 +179,124 @@ // Valuation des attributs sp\xE9cifiques au 1d pour les profils \\ GISZoneCollection zone=profils_.getGeomData(); normalizeProfilAttributes(zone); + + // D\xE9termination de la r\xE9f\xE9rence hydraulique \\ + int idxAttCommentaireHydraulique=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + boolean useAttAxeHydrau=false; + boolean attrIsCorrectlyValued=false; + if(idxAttCommentaireHydraulique!=-1) { + attrIsCorrectlyValued=true; + int i=-1; + while(attrIsCorrectlyValued&&++i<profils_.getNombre()) + attrIsCorrectlyValued=GISLib.isHydroCommentValued((String) profils_.getGeomData().getValue(idxAttCommentaireHydraulique, i), "PK"); + } + if(axeHydraulique_.getNombre()==0&&!attrIsCorrectlyValued) { + useAttAxeHydrau=true; + // Ajout de l'attribut COMMENTAIRE_HYDRO + if (idxAttCommentaireHydraulique==-1) { + GISAttributeInterface[] atts=new GISAttributeInterface[zone.getNbAttributes()+1]; + for (int k=0; k<zone.getNbAttributes(); k++) + atts[k]=zone.getAttribute(k); + atts[atts.length-1]=GISAttributeConstants.COMMENTAIRE_HYDRO; + zone.setAttributes(atts, null); + } + // Valuation de l'attribut + idxAttCommentaireHydraulique=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + for (int k=0; k<zone.getNumGeometries(); k++) { + String comm=(String)profils_.getGeomData().getValue(idxAttCommentaireHydraulique, k); + if (!GISLib.isHydroCommentValued(comm, "PK")) + zone.setAttributValue(idxAttCommentaireHydraulique, k, GISLib.setHydroCommentDouble(comm, 0, "PK"), null); + } + } + else if(axeHydraulique_.getNombre()>0&&attrIsCorrectlyValued) { + //TODO : demander \xE0 l'utilisateur lequel utiliser + boolean useAxeHydraulique=true; + if(useAxeHydraulique) { + // Destruction de l'attribut COMMENTAIRE_HYDRO + GISAttributeInterface[] atts=new GISAttributeInterface[zone.getNbAttributes()-1]; + int l=0; + for (int k=0; k<zone.getNbAttributes(); k++) + if(zone.getAttribute(k)!=GISAttributeConstants.COMMENTAIRE_HYDRO) + atts[l++]=zone.getAttribute(k); + zone.setAttributes(atts, null); + useAttAxeHydrau=true; + } + else { + // Destruction des axes hydrauliques + int[] idx=new int[axeHydraulique_.getNombre()]; + for(int i=0;i<axeHydraulique_.getNombre();i++) + idx[i]=i; + axeHydraulique_.getGeomData().removeGeometries(idx, null); + } + } + else if(axeHydraulique_.getNombre()==0) + useAttAxeHydrau=true; + int idxAttRiveGauche=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_GAUCHE); int idxAttRiveDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_RIVE_DROITE); int idxAttlsGauche=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_GAUCHE); int idxAttlsDroite=zone.getIndiceOf(GISAttributeConstants.INTERSECTION_LIMITE_STOCKAGE_DROITE); int idxAttLignesDirectrices=zone.getIndiceOf(GISAttributeConstants.INTERSECTIONS_LIGNES_DIRECTRICES); - - Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); - CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); + idxAttCommentaireHydraulique=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + orderProfils(-1, null); // Normalise le sens du profil \\ for (int k=0; k<profils_.getNombre(); k++) { Geometry profil=zone.getGeometry(k); CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); // Normalisation du sens (gauche/droite) du profil \\ - Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); + Coordinate interAxeProfil=seqProfil.getCoordinate(seqProfil.size()/2); // Cr\xE9ation du vecteur contenant le sens de l'axe hydraulique - Coordinate vAxeH; - int idxPrevious=UtilsProfil1d.getPreviousIndex(seqAxeHydraulique, interAxeProfil); - int idxNext=UtilsProfil1d.getNextIndex(seqAxeHydraulique, interAxeProfil); - if (idxPrevious!=-1) - vAxeH=new Coordinate(interAxeProfil.x-seqAxeHydraulique.getCoordinate(idxPrevious).x, interAxeProfil.y - -seqAxeHydraulique.getCoordinate(idxPrevious).y, 0); - else - vAxeH=new Coordinate(seqAxeHydraulique.getCoordinate(idxNext).x-interAxeProfil.x, - seqAxeHydraulique.getCoordinate(idxNext).y-interAxeProfil.y, 0); + Coordinate vAxeH=null; + boolean noReorientation=false; + if (k>0) { + CoordinateSequence profilPrevious=zone.getCoordinateSequence(k-1); + Coordinate pointProfilPrevious=profilPrevious.getCoordinate(profilPrevious.size()/2); + vAxeH=new Coordinate(interAxeProfil.x-pointProfilPrevious.x, interAxeProfil.y-pointProfilPrevious.y, 0); + } + else if(k<profils_.getNombre()-1){ + CoordinateSequence profilPrevious=zone.getCoordinateSequence(k+1); + Coordinate pointProfilPrevious=profilPrevious.getCoordinate(profilPrevious.size()/2); + vAxeH=new Coordinate(pointProfilPrevious.x-interAxeProfil.x, pointProfilPrevious.y-interAxeProfil.y, 0); + } + else { + if(axeHydraulique_.getNombre()>0) { + Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); + CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); + // Normalisation du sens (gauche/droite) du profil \\ + Coordinate interAxeProfil2=profil.intersection(axeHydraulique).getCoordinate(); + // Cr\xE9ation du vecteur contenant le sens de l'axe hydraulique + int idxPrevious=UtilsProfil1d.getPreviousIndex(seqAxeHydraulique, interAxeProfil2); + int idxNext=UtilsProfil1d.getNextIndex(seqAxeHydraulique, interAxeProfil2); + if (idxPrevious!=-1) + vAxeH=new Coordinate(interAxeProfil2.x-seqAxeHydraulique.getCoordinate(idxPrevious).x, interAxeProfil2.y + -seqAxeHydraulique.getCoordinate(idxPrevious).y, 0); + else + vAxeH=new Coordinate(seqAxeHydraulique.getCoordinate(idxNext).x-interAxeProfil2.x, + seqAxeHydraulique.getCoordinate(idxNext).y-interAxeProfil2.y, 0); + } + else + // Pas de r\xE9orientatin du profil dans ce cas l\xE0. + noReorientation=true; + } // Cr\xE9ation du vecteur contenant le sens du profil - Coordinate vProfilH; - idxPrevious=UtilsProfil1d.getPreviousIndex(seqProfil, interAxeProfil); - idxNext=UtilsProfil1d.getNextIndex(seqProfil, interAxeProfil); - if (idxPrevious!=-1) - vProfilH=new Coordinate(interAxeProfil.x-seqProfil.getCoordinate(idxPrevious).x, interAxeProfil.y - -seqProfil.getCoordinate(idxPrevious).y, 0); - else - vProfilH=new Coordinate(seqProfil.getCoordinate(idxNext).x-interAxeProfil.x, seqProfil.getCoordinate(idxNext).y - -interAxeProfil.y, 0); - // Inversion du sens du profil si besoin - double produitVectorielCoordZ=vAxeH.x*vProfilH.y-vAxeH.y*vProfilH.x; - if (produitVectorielCoordZ>0) { - inverseProfil(k); - profil=(Geometry)profils_.getGeomData().getGeometry(k); - seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + if (!noReorientation) { + Coordinate vProfilH; + int idxPrevious=UtilsProfil1d.getPreviousIndex(seqProfil, interAxeProfil); + int idxNext=UtilsProfil1d.getNextIndex(seqProfil, interAxeProfil); + if (idxPrevious!=-1) + vProfilH=new Coordinate(interAxeProfil.x-seqProfil.getCoordinate(idxPrevious).x, interAxeProfil.y + -seqProfil.getCoordinate(idxPrevious).y, 0); + else + vProfilH=new Coordinate(seqProfil.getCoordinate(idxNext).x-interAxeProfil.x, seqProfil.getCoordinate(idxNext).y + -interAxeProfil.y, 0); + // Inversion du sens du profil si besoin + double produitVectorielCoordZ=vAxeH.x*vProfilH.y-vAxeH.y*vProfilH.x; + if (produitVectorielCoordZ>0) { + inverseProfil(k); + profil=(Geometry)profils_.getGeomData().getGeometry(k); + seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); + } } } // Cr\xE9ation des nouveaux points sur les profils \\ @@ -244,9 +318,16 @@ // Valuation des attributs simple d'intersection (rives et limites) \\ for (int k=0; k<profils_.getNombre(); k++) { Geometry profil=zone.getGeometry(k); - CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); - Coordinate interAxeProfil=profil.intersection(axeHydraulique).getCoordinate(); - double abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); + CoordinateSequence seqProfil=zone.getCoordinateSequence(k); + double abscisseCurvIntersectionAxe; + if(useAttAxeHydrau) { + String value=(String) profils_.getGeomData().getValue(idxAttCommentaireHydraulique, k); + abscisseCurvIntersectionAxe=GISLib.getHydroCommentDouble(value, "PK"); + } + else { + Coordinate interAxeProfil=profil.intersection((GISPolyligne) axeHydraulique_.getObject(0)).getCoordinate(); + abscisseCurvIntersectionAxe=UtilsProfil1d.abscisseCurviligne(seqProfil, interAxeProfil); + } // Valuation des attributs avec les index des points des intersections \\ // Rives zone.setAttributValue(idxAttRiveGauche, k, 0, null); @@ -432,10 +513,15 @@ // Extraction d'informations sur le profils et l'axe hydraulique Geometry profil=profils_.getGeomData().getGeometry(idxTest); CoordinateSequence seqProfil=((GISCoordinateSequenceContainerInterface)profil).getCoordinateSequence(); - Coordinate intersection=profil.intersection((Geometry)axeHydraulique_.getObject(0)).getCoordinate(); - int idxAxe=UtilsProfil1d.getPreviousIndex(seqProfil, intersection); - if (idxAxe==-1) - idxAxe=0; + int idxAxe; + if(axeHydraulique_.getNombre()==0) + idxAxe=seqProfil.size()/2; + else { + Coordinate intersection=profil.intersection((Geometry)axeHydraulique_.getObject(0)).getCoordinate(); + idxAxe=UtilsProfil1d.getPreviousIndex(seqProfil, intersection); + if (idxAxe==-1) + idxAxe=0; + } // Enregistrement de l'index if (lstIntersectionTmp[idxTest]<=idxAxe) lst.add(0); @@ -525,48 +611,6 @@ } } } - - /** - * Retourne vrai si les donn\xE9es contenues dans les champs sont coh\xE9rentes. - */ - public boolean checkCoherence(){ - // TODO ajouter la verification de la pr\xE9sences des attribtus n\xE9c\xE9ssaires - if (axeHydraulique_==null||profils_==null||rives_==null||limitesStockages_==null||lignesDirectrices_==null) - return false; - // Axe hydraulique - if (axeHydraulique_.getGeomData()==null||!(axeHydraulique_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) - return false; - if ((String)axeHydraulique_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_AH) - return false; - if(axeHydraulique_.getNbPolyligne()>1) - return false; - // Lignes directrices - if (lignesDirectrices_.getGeomData()==null||!(lignesDirectrices_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) - return false; - if ((String)lignesDirectrices_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_LD) - return false; - // Limite de stockage - if (limitesStockages_.getGeomData()==null||!(limitesStockages_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) - return false; - if ((String)limitesStockages_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_LC) - return false; - if(limitesStockages_.getNbPolyligne()>2) - return false; - // Profil - if (profils_.getGeomData()==null||!(profils_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) - return false; - if ((String)profils_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_PF) - return false; - // rives - if (rives_.getGeomData()==null||!(rives_.getGeomData() instanceof GISZoneCollectionLigneBrisee)) - return false; - if ((String)rives_.getGeomData().getFixedAttributValue(GISAttributeConstants.NATURE)!=GISAttributeConstants.ATT_NATURE_RV) - return false; - if(rives_.getNbPolyligne()>2) - return false; - // Tout est ok - return true; - } /** * R\xE9ordonne les profils du bief. Retourne le nouvel indice de l'indice pass\xE9 @@ -603,19 +647,28 @@ boolean synchroniserEnable=isSynchronizerActived(); if(synchroniserEnable) gisSynchroniser_.disable(); - Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); - CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); // R\xE9ordonnancement des profils selon leur placement sur l'axe hydaulique (abs curv) \\ // Calcul des abscisses curvilignes Object[][] idxAbsCurv=new Object[profils_.getNombre()][]; - for(int j=0;j<profils_.getNombre();j++) { - Geometry intersection=axeHydraulique.intersection((Geometry) profils_.getObject(j)); - if(intersection.getNumPoints()==0) - throw new IllegalArgumentException("Au moins un des profils ne coupe jamais l'axe hydraulique."); - if(intersection.getNumPoints()>1) - throw new IllegalArgumentException("Au moins un des profils coupe plusieurs fois l'axe hydraulique."); - idxAbsCurv[j]=new Object[]{j, UtilsProfil1d.abscisseCurviligne(seqAxeHydraulique, intersection.getCoordinate())}; + if(axeHydraulique_.getNombre()==0) { + for(int j=0;j<profils_.getNombre();j++) { + GISZoneCollection zone=profils_.getGeomData(); + String value=(String) zone.getValue(zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), j); + idxAbsCurv[j]=new Object[]{j, GISLib.getHydroCommentDouble(value, "PK")}; + } } + else { + Geometry axeHydraulique=(Geometry)axeHydraulique_.getObject(0); + CoordinateSequence seqAxeHydraulique=((GISCoordinateSequenceContainerInterface)axeHydraulique).getCoordinateSequence(); + for(int j=0;j<profils_.getNombre();j++) { + Geometry intersection=axeHydraulique.intersection((Geometry) profils_.getObject(j)); + if(intersection.getNumPoints()==0) + throw new IllegalArgumentException("Au moins un des profils ne coupe jamais l'axe hydraulique."); + if(intersection.getNumPoints()>1) + throw new IllegalArgumentException("Au moins un des profils coupe plusieurs fois l'axe hydraulique."); + idxAbsCurv[j]=new Object[]{j, UtilsProfil1d.abscisseCurviligne(seqAxeHydraulique, intersection.getCoordinate())}; + } + } // Tri en fonction des abcsisses curvilignes Arrays.sort((Object[])idxAbsCurv, new Comparator<Object>(){ public int compare(Object o1, Object o2) { @@ -779,6 +832,8 @@ * Retourne -1 si \xE0 gauche, 0 si ind\xE9terminable, 1 si \xE0 droite. */ private int position(Geometry _geom) { + if(axeHydraulique_.getNombre()==0) + return 0; // Recherche d'intersection de _geom avec un profil boolean found=false; int i=-1; Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-11 10:57:27 UTC (rev 4455) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/ProfilContainerAdapter.java 2009-02-11 11:48:56 UTC (rev 4456) @@ -25,6 +25,7 @@ import org.fudaa.ctulu.gis.GISAttributeModelIntegerList; import org.fudaa.ctulu.gis.GISCoordinateSequenceContainerInterface; import org.fudaa.ctulu.gis.GISGeometryFactory; +import org.fudaa.ctulu.gis.GISLib; import org.fudaa.ctulu.gis.GISZoneCollection; import org.fudaa.ctulu.gis.GISZoneCollectionLigneBrisee; import org.fudaa.fudaa.commun.FudaaLib; @@ -232,8 +233,12 @@ } else if (biefContainer_.getZoneProfils()!=null&&idxProfilSelected_>=0&&idxProfilSelected_<biefContainer_.getZoneProfils().getNbGeometries()&&biefContainer_.getZoneProfils().getAttributeIsZ()!=null) { try { - int idxAttrDecCurv=biefContainer_.getZoneAxeHydraulique().getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE); - curviligneDecalage_=(Double) biefContainer_.getZoneAxeHydraulique().getValue(idxAttrDecCurv, 0); + if(biefContainer_.getZoneAxeHydraulique().getNumGeometries()==0) + curviligneDecalage_=0; + else { + int idxAttrDecCurv=biefContainer_.getZoneAxeHydraulique().getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE); + curviligneDecalage_=(Double) biefContainer_.getZoneAxeHydraulique().getValue(idxAttrDecCurv, 0); + } z_=(CtuluCollection)biefContainer_.getZoneProfils().getValue(biefContainer_.getZoneProfils().getIndiceOf(biefContainer_.getZoneProfils().getAttributeIsZ()), idxProfilSelected_); curv_=new ArrayList<Double>(); CoordinateSequence seq=((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)).getCoordinateSequence(); @@ -350,10 +355,16 @@ } public double getAbsCurvProfilOnAxeHydraulique() { - if (idxProfilSelected_==-1||biefContainer_.getZoneAxeHydraulique().getNbGeometries()==0) + if (idxProfilSelected_==-1) return -1; - return UtilsProfil1d.abscisseCurviligne(((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneAxeHydraulique() - .getGeometry(0)).getCoordinateSequence(), getCoordSeq())+curviligneDecalage_; + if(biefContainer_.getZoneAxeHydraulique().getNbGeometries()==0) { + GISZoneCollection zone=biefContainer_.getZoneProfils(); + String value=(String)zone.getValue(zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO), idxProfilSelected_); + return GISLib.getHydroCommentDouble(value, "PK"); + } + else + return UtilsProfil1d.abscisseCurviligne(biefContainer_.getZoneAxeHydraulique() + .getCoordinateSequence(0), getCoordSeq())+curviligneDecalage_; } public int getNbLignesDirectrices() { @@ -450,7 +461,7 @@ } public double getAbsCurvAxeHydrauliqueOnProfil() { - if(idxProfilSelected_==-1||biefContainer_.getZoneAxeHydraulique().getNbGeometries()==0) + if (idxProfilSelected_==-1||biefContainer_.getZoneAxeHydraulique().getNbGeometries()==0) return -1; Geometry intersection=biefContainer_.getZoneAxeHydraulique().getGeometry(0).intersection( biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)); @@ -526,134 +537,120 @@ public boolean setAbsCurvProfilOnAxeHydraulique(double _value, CtuluCommandContainer _cmd) throws ProfilContainerException { _value=_value-curviligneDecalage_; - CoordinateSequence axeHydrau=((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneAxeHydraulique().getGeometry(0)) - .getCoordinateSequence(); - Geometry geomAxeHydrau=biefContainer_.getZoneAxeHydraulique().getGeometry(0); - if (_value<0||_value>UtilsProfil1d.abscisseCurviligne(axeHydrau, axeHydrau.getCoordinate(axeHydrau.size()-1))) - throw new IllegalArgumentException(FudaaLib.getS("L'abscisse curviligne doit \xEAtre entre " +curviligneDecalage_+" et " - +(UtilsProfil1d.abscisseCurviligne(axeHydrau, axeHydrau.getCoordinate(axeHydrau.size()-1))+curviligneDecalage_)+" inclus.")); - CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un profil")); - // Calcul de la coordonn\xE9e actuelle de croisement entre l'axe et le profil - Geometry intersection=geomAxeHydrau.intersection( - biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)); - if (intersection.getNumPoints()!=1) - throw new ProfilContainerException(FudaaLib - .getS("Soit il n'y a pas de croisement avec l'axe hydraulique, soit il y en a plusieurs.")); - // Point de croisement actuel entre l'axe et le profil - Coordinate oldCoordCroisement=intersection.getCoordinate(); - double oldAbscisseCurviligne=UtilsProfil1d.abscisseCurviligne(axeHydrau, oldCoordCroisement); - if (!UtilsProfil1d.egal(_value, oldAbscisseCurviligne)) { - // Cr\xE9ation d'une selection contenant la g\xE9om\xE9trie \xE0 modifier - BitSet bs=new BitSet(biefContainer_.getZoneProfils().getNbGeometries()); - bs.set(idxProfilSelected_); - CtuluListSelection selection=new CtuluListSelection(bs); - // Calcul du future point de croisement entre l'axe et le profil - Coordinate newCoordCroisement=UtilsProfil1d.getCoordinateXY(axeHydrau, _value); - // Application de la translation - Coordinate move=UtilsProfil1d.vec(oldCoordCroisement, newCoordCroisement); - biefContainer_.getModelProfils().moveGlobal(selection, move.x, move.y, 0, cmd); - // Somme de tous les angles de l'axe entre les deux points de translation - int oldNextIdx=UtilsProfil1d.getNextIndex(axeHydrau, oldCoordCroisement); - if (oldNextIdx==-1) - oldNextIdx=axeHydrau.size()-1; - double oldAngle=0; - for (int i=0; i+2<=oldNextIdx; i++) - oldAngle+=Math.PI - -UtilsProfil1d.getAngle(axeHydrau.getCoordinate(i), axeHydrau.getCoordinate(i+1), axeHydrau.getCoordinate(i+2)); - int newNextIdx=UtilsProfil1d.getNextIndex(axeHydrau, newCoordCroisement); - if (newNextIdx==-1) - newNextIdx=axeHydrau.size()-1; - double newAngle=0; - for (int i=0; i+2<=newNextIdx; i++) - newAngle+=Math.PI - -UtilsProfil1d.getAngle(axeHydrau.getCoordinate(i), axeHydrau.getCoordinate(i+1), axeHydrau.getCoordinate(i+2)); - // Application de la rotation - biefContainer_.getModelProfils().rotateGlobal(selection, newAngle-oldAngle, newCoordCroisement.x, newCoordCroisement.y, cmd); - // Verifie que le profil ne coupe pas deux fois l'axe hydraulique - Geometry intersect=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)); - if(intersect.getNumPoints()!=1) { - cmd.undo(); // Annulation des modifications - throw new ProfilContainerException(FudaaLib.getS("Le profil couperait l'axe hydraulique en au moins deux endroits.")); + if (biefContainer_.getZoneAxeHydraulique().getNumGeometries()>0) { + CoordinateSequence axeHydrau=((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneAxeHydraulique().getGeometry(0)) + .getCoordinateSequence(); + Geometry geomAxeHydrau=biefContainer_.getZoneAxeHydraulique().getGeometry(0); + if (_value<0||_value>UtilsProfil1d.abscisseCurviligne(axeHydrau, axeHydrau.getCoordinate(axeHydrau.size()-1))) + throw new IllegalArgumentException(FudaaLib.getS("L'abscisse curviligne doit \xEAtre entre "+curviligneDecalage_+" et " + +(UtilsProfil1d.abscisseCurviligne(axeHydrau, axeHydrau.getCoordinate(axeHydrau.size()-1))+curviligneDecalage_) + +" inclus.")); + CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un profil")); + // Calcul de la coordonn\xE9e actuelle de croisement entre l'axe et le profil + Geometry intersection=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)); + if (intersection.getNumPoints()!=1) + throw new ProfilContainerException(FudaaLib + .getS("Soit il n'y a pas de croisement avec l'axe hydraulique, soit il y en a plusieurs.")); + // Point de croisement actuel entre l'axe et le profil + Coordinate oldCoordCroisement=intersection.getCoordinate(); + double oldAbscisseCurviligne=UtilsProfil1d.abscisseCurviligne(axeHydrau, oldCoordCroisement); + if (!UtilsProfil1d.egal(_value, oldAbscisseCurviligne)) { + // Cr\xE9ation d'une selection contenant la g\xE9om\xE9trie \xE0 modifier + BitSet bs=new BitSet(biefContainer_.getZoneProfils().getNbGeometries()); + bs.set(idxProfilSelected_); + CtuluListSelection selection=new CtuluListSelection(bs); + // Calcul du future point de croisement entre l'axe et le profil + Coordinate newCoordCroisement=UtilsProfil1d.getCoordinateXY(axeHydrau, _value); + // Application de la translation + Coordinate move=UtilsProfil1d.vec(oldCoordCroisement, newCoordCroisement); + biefContainer_.getModelProfils().moveGlobal(selection, move.x, move.y, 0, cmd); + // Somme de tous les angles de l'axe entre les deux points de + // translation + int oldNextIdx=UtilsProfil1d.getNextIndex(axeHydrau, oldCoordCroisement); + if (oldNextIdx==-1) + oldNextIdx=axeHydrau.size()-1; + double oldAngle=0; + for (int i=0; i+2<=oldNextIdx; i++) + oldAngle+=Math.PI + -UtilsProfil1d.getAngle(axeHydrau.getCoordinate(i), axeHydrau.getCoordinate(i+1), axeHydrau.getCoordinate(i+2)); + int newNextIdx=UtilsProfil1d.getNextIndex(axeHydrau, newCoordCroisement); + if (newNextIdx==-1) + newNextIdx=axeHydrau.size()-1; + double newAngle=0; + for (int i=0; i+2<=newNextIdx; i++) + newAngle+=Math.PI + -UtilsProfil1d.getAngle(axeHydrau.getCoordinate(i), axeHydrau.getCoordinate(i+1), axeHydrau.getCoordinate(i+2)); + // Application de la rotation + biefContainer_.getModelProfils() + .rotateGlobal(selection, newAngle-oldAngle, newCoordCroisement.x, newCoordCroisement.y, cmd); + // Verifie que le profil ne coupe pas deux fois l'axe hydraulique + Geometry intersect=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)); + if (intersect.getNumPoints()!=1) { + cmd.undo(); // Annulation des modifications + throw new ProfilContainerException(FudaaLib.getS("Le profil couperait l'axe hydraulique en au moins deux endroits.")); + } + // Gestion de l'undo/redo + if (_cmd!=null) + _cmd.addCmd(cmd.getSimplify()); + // Retourne vrai si il faut r\xE9ordonnancer les profils + int oldPreviousIdx=UtilsProfil1d.getPreviousIndex(axeHydrau, oldCoordCroisement); + if (oldPreviousIdx==-1) + oldPreviousIdx=0; + if (idxProfilSelected_==0) { + if (biefContainer_.getNbProfil()>1) { + Geometry inter=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_+1)); + if (inter.getNumPoints()!=1) + throw new ProfilContainerException(FudaaLib + .getS("Au moins un profil n'a pas de croisement avec l'axe hydraulique ou en a plusieurs.")); + if (_value>UtilsProfil1d.abscisseCurviligne(axeHydrau, inter.getCoordinate())) + return true; + } + } + else if (idxProfilSelected_==biefContainer_.getNbProfil()-1) { + if (biefContainer_.getNbProfil()>1) { + Geometry inter=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_-1)); + if (inter.getNumPoints()!=1) + throw new ProfilContainerException(FudaaLib + .getS("Au moins un profil n'a pas de croisement avec l'axe hydraulique ou en a plusieurs.")); + if (_value<UtilsProfil1d.abscisseCurviligne(axeHydrau, inter.getCoordinate())) + return true; + } + } + else { + Geometry intersect1=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_+1)); + Geometry intersect2=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_-1)); + if (intersect1.getNumPoints()!=1||intersect2.getNumPoints()!=1) + throw new ProfilContainerException(FudaaLib + .getS("Au moins un profil n'a pas de croisement avec l'axe hydraulique ou en a plusieurs.")); + double abscCurvProfilPrecedent=UtilsProfil1d.abscisseCurviligne(axeHydrau, intersect2.getCoordinate()); + double abscCurvProfilSuivant=UtilsProfil1d.abscisseCurviligne(axeHydrau, intersect1.getCoordinate()); + if (_value<abscCurvProfilPrecedent||_value>abscCurvProfilSuivant) + return true; + } } + return false; + } + else { // Modification bas\xE9e sur l'attribut commentaire hydraulique. + CtuluCommandComposite cmd=new CtuluCommandComposite(FudaaLib.getS("D\xE9placement d'un profil")); + GISZoneCollection zone=biefContainer_.getZoneProfils(); + int idxAttrComm=zone.getIndiceOf(GISAttributeConstants.COMMENTAIRE_HYDRO); + String comm=(String) zone.getValue(idxAttrComm, idxProfilSelected_); + zone.setAttributValue(idxAttrComm, idxProfilSelected_, GISLib.setHydroCommentDouble(comm, _value, "PK"), cmd); // Gestion de l'undo/redo if (_cmd!=null) _cmd.addCmd(cmd.getSimplify()); // Retourne vrai si il faut r\xE9ordonnancer les profils - int oldPreviousIdx=UtilsProfil1d.getPreviousIndex(axeHydrau, oldCoordCroisement); - if (oldPreviousIdx==-1) - oldPreviousIdx=0; - if(idxProfilSelected_==0) { - if(biefContainer_.getNbProfil()>1) { - Geometry inter=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_+1)); - if(inter.getNumPoints()!=1) - throw new ProfilContainerException(FudaaLib.getS("Au moins un profil n'a pas de croisement avec l'axe hydraulique ou en a plusieurs.")); - if (_value>UtilsProfil1d.abscisseCurviligne(axeHydrau, inter.getCoordinate())) - return true; - } - } - else if (idxProfilSelected_==biefContainer_.getNbProfil()-1) { - if(biefContainer_.getNbProfil()>1) { - Geometry inter=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_-1)); - if(inter.getNumPoints()!=1) - throw new ProfilContainerException(FudaaLib.getS("Au moins un profil n'a pas de croisement avec l'axe hydraulique ou en a plusieurs.")); - if (_value<UtilsProfil1d.abscisseCurviligne(axeHydrau, inter.getCoordinate())) - return true; - } - } - else { - Geometry intersect1=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_+1)); - Geometry intersect2=geomAxeHydrau.intersection(biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_-1)); - if(intersect1.getNumPoints()!=1||intersect2.getNumPoints()!=1) - throw new ProfilContainerException(FudaaLib.getS("Au moins un profil n'a pas de croisement avec l'axe hydraulique ou en a plusieurs.")); - double abscCurvProfilPrecedent=UtilsProfil1d.abscisseCurviligne(axeHydrau, intersect2.getCoordinate()); - double abscCurvProfilSuivant=UtilsProfil1d.abscisseCurviligne(axeHydrau, intersect1.getCoordinate()); - if (_value<abscCurvProfilPrecedent||_value>abscCurvProfilSuivant) + if(idxProfilSelected_>0) { + if(GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, idxProfilSelected_-1), "PK")>_value) return true; } + else if(zone.getNumGeometries()-1<idxProfilSelected_) + if(GISLib.getHydroCommentDouble((String)zone.getValue(idxAttrComm, idxProfilSelected_+1), "PK")>_value) + return true; + return false; } - return false; } - /** - * Retourne l'angle entre l'axe hydraulique et le profil - * @throws ProfilContainerException - */ - @SuppressWarnings("unused") - private double getAngleAxeHydrauProfil() throws ProfilContainerException { - CoordinateSequence axeHydraulique=((GISCoordinateSequenceContainerInterface)biefContainer_.getZoneAxeHydraulique().getGeometry( - 0)).getCoordinateSequence(); - // Calcul de la coordonn\xE9e de croisement entre l'axe et le profil - Geometry intersection=biefContainer_.getZoneAxeHydraulique().getGeometry(0).intersection( - biefContainer_.getZoneProfils().getGeometry(idxProfilSelected_)); - if (intersection.getNumPoints()!=1) - throw new ProfilContainerException(FudaaLib - .getS("Soit il n'y a pas de croisement avec l'axe hydraulique, soit il y en a plusieurs.")); - Coordinate coordCroisement=intersection.getCoordinate(); - // Recherche du point pr\xE9c\xE9dent le croisement sur l'axe hydraulique - Coordinate previousPointAH; - int idxPointPreviousAH=UtilsProfil1d.getPreviousIndex(axeHydraulique, coordCroisement); - if (idxPointPreviousAH!=-1) - previousPointAH=axeHydraulique.getCoordinate(idxPointPreviousAH); - else - // Cr\xE9ation d'un nouveau point en faisant la sym\xE9trie du second par - // rapport au premier. - previousPointAH=new Coordinate(axeHydraulique.getCoordinate(0).x*2-axeHydraulique.getCoordinate(1).x, axeHydraulique - .getCoordinate(0).y*2-axeHydraulique.getCoordinate(1).y, 0); - // Recherche du point suivant le croisement sur le profil - Coordinate previousPointP; - int idxPointPreviousP=UtilsProfil1d.getPreviousIndex(getCoordSeq(), coordCroisement); - if (idxPointPreviousP!=-1) - previousPointP=getCoordSeq().getCoordinate(idxPointPreviousAH); - else { - CoordinateSequence seq=getCoordSeq(); - // Cr\xE9ation d'un nouveau point en faisant la sym\xE9trie du second par - // rapport au premier. - previousPointP=new Coordinate(seq.getCoordinate(seq.size()-1).x*2-seq.getCoordinate(seq.size()-2).x, seq.getCoordinate(seq - .size()-1).y*2-seq.getCoordinate(seq.size()-2).y, 0); - } - return UtilsProfil1d.getAngle(previousPointAH, coordCroisement, previousPointP); - } - public double getCurv(int _idxPoint) { if(curv_==null||_idxPoint<0||_idxPoint>=curv_.size()) throw new IllegalArgumentException("Cet index n'existe pas."); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-02-11 10:57:27 UTC (rev 4455) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/model/UtilsProfil1d.java 2009-02-11 11:48:56 UTC (rev 4456) @@ -438,4 +438,5 @@ } return data; } + } Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionAxeHydraulique.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionAxeHydraulique.java 2009-02-11 10:57:27 UTC (rev 4455) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueModuleGestionAxeHydraulique.java 2009-02-11 11:48:56 UTC (rev 4456) @@ -27,7 +27,7 @@ /** * Petit module permettant de modifier les propri\xE9t\xE9s de l'axe hydraulique. * @author Emmanuel MARTIN - * @version $Id:$ + * @version $Id$ */ public class VueModuleGestionAxeHydraulique extends BuPanel{ @@ -66,8 +66,10 @@ try { double value=Double.parseDouble(btDecalageCurviligne_.getText()); GISZoneCollection zone=controllerBief_.getBiefContainer().getZoneAxeHydraulique(); - int idxAttr=zone.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE); - zone.setAttributValue(idxAttr, 0, value, controllerBief_.getCommandManager()); + if(zone.getNumGeometries()>0) { + int idxAttr=zone.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE); + zone.setAttributValue(idxAttr, 0, value, controllerBief_.getCommandManager()); + } } catch(NumberFormatException _ex) {} } @@ -81,7 +83,7 @@ */ private String getDecalageCurviligne() { GISZoneCollection zone=controllerBief_.getBiefContainer().getZoneAxeHydraulique(); - if(zone==null) + if(zone==null||zone.getNumGeometries()==0) return ""; int idxAttr=zone.getIndiceOf(GISAttributeConstants.CURVILIGNE_DECALAGE); return Double.toString((Double) zone.getValue(idxAttr, 0)); Modified: branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java =================================================================== --- branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-02-11 10:57:27 UTC (rev 4455) +++ branches/FudaaModeleur_TC1Bis/fudaa_devel/fudaa/src/org/fudaa/fudaa/modeleur/modeleur1d/view/VueTableau.java 2009-02-11 11:48:56 UTC (rev 4456) @@ -23,7 +23,6 @@ import org.fudaa.ctulu.CtuluCommandComposite; import org.fudaa.ctulu.gui.CtuluTable; -import org.fud... [truncated message content] |