From: <de...@us...> - 2008-08-06 21:57:34
|
Revision: 3720 http://fudaa.svn.sourceforge.net/fudaa/?rev=3720&view=rev Author: deniger Date: 2008-08-06 21:57:43 +0000 (Wed, 06 Aug 2008) Log Message: ----------- maj calcul repere Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2008-08-06 21:57:11 UTC (rev 3719) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2008-08-06 21:57:43 UTC (rev 3720) @@ -248,16 +248,15 @@ public void componentShown(final ComponentEvent _e) {} - public EGMarges computeMarges() { - final Graphics2D gr = (Graphics2D) getGraphics(); + public EGMarges computeMarges(Graphics2D _gr ) { final EGMarges m = new EGMarges(); final EGAxeHorizontal xaxe = transformer_.getXAxe(); if (xaxe == null) { m.setBas(5); m.setDroite(5); } else { - m.setBas(xaxe.getBottomHeightNeeded(gr)); - m.setDroite(xaxe.getRightWidthNeeded(gr)); + m.setBas(xaxe.getBottomHeightNeeded(_gr)); + m.setDroite(xaxe.getRightWidthNeeded(_gr)); } m.setGauche(0); m.setHaut(0); @@ -274,15 +273,15 @@ axeSet.add(axe); if (axe.isDroite()) { - m.ajouteMargesDroite(axe.getWidthNeeded(gr)); + m.ajouteMargesDroite(axe.getWidthNeeded(_gr)); // on recupere le dernier pour enlever la partie qui sera dessin\xE9 dans le graphe /* if (lastRight == null) */lastRight = axe; } else { - m.ajouteMargesGauche(axe.getWidthNeeded(gr)); + m.ajouteMargesGauche(axe.getWidthNeeded(_gr)); // meme combat /* if (last == null) */last = axe; } - temp = o.getMargeHautNeeded(gr); + temp = o.getMargeHautNeeded(_gr); if (temp > m.getHaut()) { m.setHaut(temp); } @@ -291,11 +290,11 @@ } // on enleve les parties dessin\xE9es dans le graphe if (last != null) { - m.setGauche(m.getGauche() - last.getWidthDrawnInGraphe(gr)); + m.setGauche(m.getGauche() - last.getWidthDrawnInGraphe(_gr)); } // on enleve les parties dessin\xE9es dans le graphe if (lastRight != null) { - m.setDroite(m.getDroite() - lastRight.getWidthDrawnInGraphe(gr)); + m.setDroite(m.getDroite() - lastRight.getWidthDrawnInGraphe(_gr)); } if (m.getGauche() <= 0) { m.setGauche(15); @@ -331,7 +330,7 @@ structureChanged(_mustRestore); } - private void dessine(final Graphics _g, final int _w, final int _h, final boolean _fill) { + public void dessine(final Graphics _g, final int _w, final int _h, final boolean _fill) { if (!isVisible()) { return; } @@ -350,7 +349,7 @@ g2d.setColor(Color.black); final EGGrapheModel model = getModel(); final int nbElement = model.getNbEGObject(); - transformer_.initFor(this); + transformer_.initFor(g2d,this); // dessine axe horizontal final Shape oldClip = g2d.getClip(); // g2d.clip(new Rectangle(xMarge, yMarge, wMarge, hMarge)); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java 2008-08-06 21:57:11 UTC (rev 3719) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java 2008-08-06 21:57:43 UTC (rev 3720) @@ -7,6 +7,7 @@ */ package org.fudaa.ebli.courbe; +import java.awt.Graphics2D; import java.awt.geom.Point2D; /** @@ -15,98 +16,102 @@ */ public class EGRepere { - private EGAxeHorizontal xAxe_; - private EGMarges marges_; - private int w_; - private int h_; + private EGAxeHorizontal xAxe_; + private EGMarges marges_; + private int w_; + private int h_; - public EGRepere() { - super(); - marges_ = new EGMarges(); - } - + public EGRepere() { + super(); + marges_ = new EGMarges(); + } - public int getMargesGauche(){ - return marges_.getGauche(); - } + public int getMargesGauche() { + return marges_.getGauche(); + } - public int getMargesDroite(){ - return marges_.getDroite(); - } + public int getMargesDroite() { + return marges_.getDroite(); + } - public int getMargesBas(){ - return marges_.getBas(); - } + public int getMargesBas() { + return marges_.getBas(); + } - public void initFor(final EGGraphe _g){ - w_ = _g.getWidth(); - h_ = _g.getHeight(); - marges_ = _g.computeMarges(); - marges_.ajouteEmptyBorder(3); - xAxe_=_g.getModel().getAxeX(); - } + public void initFor(final Graphics2D _g2d, final EGGraphe _g) { + w_ = _g.getWidth(); + h_ = _g.getHeight(); + marges_ = _g.computeMarges(_g2d); + marges_.ajouteEmptyBorder(3); + xAxe_ = _g.getModel().getAxeX(); + } - public void setXAxe(final EGAxeHorizontal _axe){ - xAxe_ = _axe; - } + public void setXAxe(final EGAxeHorizontal _axe) { + xAxe_ = _axe; + } - public int getMaxEcranY(){ - return h_ - marges_.getBas(); - } + public int getMaxEcranY() { + return h_ - marges_.getBas(); + } - public int getMinEcranY(){ - return marges_.getHaut(); - } + public int getMinEcranY() { + return marges_.getHaut(); + } - public int getMaxEcranX(){ - return w_ - marges_.getDroite(); - } + public int getMaxEcranX() { + return w_ - marges_.getDroite(); + } - public int getMinEcranX(){ - return marges_.getGauche(); - } + public int getMinEcranX() { + return marges_.getGauche(); + } - public EGAxeHorizontal getXAxe(){ - return xAxe_; - } + public EGAxeHorizontal getXAxe() { + return xAxe_; + } - public int getWSansMarges(){ - return w_ - marges_.getHorizontalMarges(); - } + public int getWSansMarges() { + return w_ - marges_.getHorizontalMarges(); + } - public int getHSansMarges(){ - return h_ - marges_.getVerticalMarges(); - } + public int getHSansMarges() { + return h_ - marges_.getVerticalMarges(); + } - public void versReel(final int _xEcran,final int _yEcran,final Point2D.Double _ptReel,final EGAxeVertical _yAxe){ - _ptReel.setLocation(getXReel(_xEcran), getYReel(_yEcran, _yAxe)); - } + public void versReel(final int _xEcran, final int _yEcran, + final Point2D.Double _ptReel, final EGAxeVertical _yAxe) { + _ptReel.setLocation(getXReel(_xEcran), getYReel(_yEcran, _yAxe)); + } - public double getXReel(final int _xEcran){ - return xAxe_.getValueFromPosition(xAxe_.getMinimum() + (_xEcran - marges_.getGauche()) - * xAxe_.getEcart() / (getWSansMarges())); - } + public double getXReel(final int _xEcran) { + return xAxe_.getValueFromPosition(xAxe_.getMinimum() + + (_xEcran - marges_.getGauche()) * xAxe_.getEcart() + / (getWSansMarges())); + } - public double getYReel(final int _yEcran,final EGAxeVertical _yAxe){ - return _yAxe.getValueFromPosition(_yAxe.getMinimum() - + ((-_yEcran + h_ - marges_.getBas()) * (_yAxe.getEcart())) - / (getHSansMarges())); - } + public double getYReel(final int _yEcran, final EGAxeVertical _yAxe) { + return _yAxe.getValueFromPosition(_yAxe.getMinimum() + + ((-_yEcran + h_ - marges_.getBas()) * (_yAxe.getEcart())) + / (getHSansMarges())); + } - public int getXEcran(final double _x){ - final double x = xAxe_.getPositionFromValue(_x); - return marges_.getGauche() - + (int) (getWSansMarges() * ((x - xAxe_.getMinimum()) / xAxe_.getEcart())); - } + public int getXEcran(final double _x) { + final double x = xAxe_.getPositionFromValue(_x); + return marges_.getGauche() + + (int) (getWSansMarges() * ((x - xAxe_.getMinimum()) / xAxe_ + .getEcart())); + } - public int getYEcran(final double _y,final EGAxeVertical _axeY){ - final double y = _axeY.getPositionFromValue(_y); - return -marges_.getBas() + h_ - - (int) (getHSansMarges() * ((y - _axeY.getMinimum()) / _axeY.getEcart())); - } + public int getYEcran(final double _y, final EGAxeVertical _axeY) { + final double y = _axeY.getPositionFromValue(_y); + return -marges_.getBas() + + h_ + - (int) (getHSansMarges() * ((y - _axeY.getMinimum()) / _axeY + .getEcart())); + } - public int getH() { - return h_; - } + public int getH() { + return h_; + } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <de...@us...> - 2008-08-18 14:10:45
|
Revision: 3823 http://fudaa.svn.sourceforge.net/fudaa/?rev=3823&view=rev Author: deniger Date: 2008-08-18 14:10:54 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Modified Paths: -------------- 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/EGCourbeSimple.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGroup.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java Added Paths: ----------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheDuplicator.java 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 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbe.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -244,7 +244,7 @@ protected abstract EGParent getEGParent(); - public abstract EGCourbe duplicate(); + public abstract EGCourbe duplicate(EGParent newParent,EGGrapheDuplicator _duplicator); protected Font getFont() { return font_; 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 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeChild.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -14,7 +14,8 @@ import com.memoire.fu.FuLog; /** - * Cette Courbe suppose que tous les x du mod\xE8le sont rang\xE9es dans l'ordre croissant. + * Cette Courbe suppose que tous les x du mod\xE8le sont rang\xE9es dans l'ordre + * croissant. * * @author deniger * @version $Id: EGCourbeChild.java,v 1.8 2007-05-04 13:49:41 deniger Exp $ @@ -31,9 +32,6 @@ super(_model); parent_ = _m; } - - - boolean setYaxe(final EGAxeVertical _v) { FuLog.warning(new Throwable()); @@ -83,33 +81,24 @@ public void setParentGroup(final EGGroup _g) { parent_ = _g; } - - - public EGCourbe duplicate() { - + + public EGCourbe duplicate(EGParent newParent, EGGrapheDuplicator _duplicator) { + EGCourbeChild duplic = null; + if (this.getModel() != null) duplic = new EGCourbeChild((EGGroup) newParent, this.getModel().duplicate()); + else duplic = new EGCourbeChild((EGGroup) newParent, null); - - if (this.getModel() != null) - duplic = new EGCourbeChild(this.parent_.duplicate(), this.getModel().duplicate()); - else - duplic = new EGCourbeChild(this.parent_.duplicate(), null); - - duplic.isVisible_ = this.isVisible_; - - + duplic.displayTitleOnCurve_ = this.displayTitleOnCurve_; duplic.font_ = new Font(this.font_.getFamily(), this.font_.getStyle(), this.font_.getSize()); - duplic.tbox_ = this.tbox_.duplicate(); - - - // -- duplication du egCourbeSurfacePainter --// + duplic.tbox_ = this.tbox_.duplicate(); + + // -- duplication du egCourbeSurfacePainter --// duplic.surfacePainter_ = this.surfacePainter_.duplicate(); - + return duplic; } - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSimple.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -61,7 +61,7 @@ } @Override - public EGCourbe duplicate() { + public EGCourbe duplicate(EGParent newParent, EGGrapheDuplicator _duplicator) { EGCourbeSimple duplic = new EGCourbeSimple(this.v_.duplicate(), this.getModel().duplicate()); duplic.isVisible_ = this.isVisible_; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGCourbeSurfacePainter.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -317,8 +317,10 @@ model_ = _model; } - public EGCourbeSurfacePainter duplicate() { - EGCourbeSurfacePainter duplic = new EGCourbeSurfacePainter(this.targetCourbe_.duplicate(), this.model_.duplicate()); + public EGCourbeSurfacePainter duplicate(EGGrapheDuplicator _duplicator) { + //TODO: targetCourbe_.duplicate() n'est pas dans le graphe. Il faut une Map avec les anciennes/nouvelles valeurs + //pas bon la courbe va etre duplique ailleurs + EGCourbeSurfacePainter duplic = new EGCourbeSurfacePainter(this.targetCourbe_.duplicate(_duplicator), this.model_.duplicate(null)); duplic.alpha_ = this.alpha_; duplic.delegateCourbe_ = new DelegateCourbe(duplic.model_); duplic.down_ = this.down_; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGraphe.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -863,12 +863,14 @@ } public EGGraphe duplicate() { - - EGGraphe duplic = new EGGraphe(this.getModel().duplicate()); + EGGrapheDuplicator duplicator=new EGGrapheDuplicator(); + EGGraphe duplic = new EGGraphe(this.getModel().duplicate(duplicator)); duplic.autoRestore_ = this.autoRestore_; duplic.cache_ = null; - duplic.cmd_ = this.cmd_; + //on ne partage pas les undo/redo + duplic.cmd_ = new CtuluCommandManager(); + //TODO: il y a soucis: les axes verticaux sont dupliqu\xE9 de partout et on n'a plus les ref // -- copie des axes --// if(this.axeOffset_!=null){ duplic.axeOffset_=new TObjectIntHashMap(); @@ -877,7 +879,7 @@ for (int i = 0; i < liste.length; i++) { int value = values[i]; EGAxeVertical axe = (EGAxeVertical) liste[i]; - duplic.axeOffset_.put(axe.duplicate(), value); + duplic.axeOffset_.put(duplicator.duplicateAxeV(axe), value); } } duplic.coeffLarger_=this.coeffLarger_; @@ -890,13 +892,13 @@ int cpt = 0; for (Iterator it = set.iterator(); it.hasNext();) { EGAxeVertical axe = (EGAxeVertical) it.next(); - duplic.objectInitAxe_.put(axe.duplicate(), vals[cpt++]); + duplic.objectInitAxe_.put(duplicator.duplicateAxeV(axe), vals[cpt++]); } } if (this.xRange_ != null) duplic.xRange_ = new CtuluRange(this.xRange_); if (this.transformer_ != null) - duplic.transformer_ = this.transformer_.duplicate(); + duplic.transformer_ = this.transformer_.duplicate(duplicator); if (this.xRangeSpecByUser_ != null) duplic.xRangeSpecByUser_ = new CtuluRange(this.xRangeSpecByUser_); Added: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheDuplicator.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheDuplicator.java (rev 0) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheDuplicator.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -0,0 +1,50 @@ +package org.fudaa.ebli.courbe; + +import java.util.HashMap; +import java.util.Map; + +/** + * Permet de sauvegarder les axes deja duplique et de mettre \xE0 jour les + * r\xE9f\xE9rences + * + * @author deniger + * + */ +public class EGGrapheDuplicator { + + Map<EGAxeVertical, EGAxeVertical> oldNew_ = new HashMap<EGAxeVertical, EGAxeVertical>(); + EGAxeHorizontal oldH_; + EGAxeHorizontal newH_; + + /** + * @param _vert l'axe a dupliquer + * @return l'axe duplique en prenant soin de ne pas le recreer + */ + public EGAxeVertical duplicateAxeV(EGAxeVertical _vert) { + EGAxeVertical res = oldNew_.get(_vert); + if (res == null) { + res = _vert.duplicate(); + oldNew_.put(_vert, res); + } + return res; + } + + /** + * @param _vert l'axe horizontal a dupliquer. On suppose qu'il n'y a qu'un + * seul axe h. + * @return l'axe duplique + */ + public EGAxeHorizontal duplicateAxeH(EGAxeHorizontal _vert){ + if(oldH_!=null && _vert!=oldH_){ + //est-ce necessaire... + throw new IllegalArgumentException(" un seul axe horizontal par graphe"); + } + + if(newH_==null) { + oldH_=_vert; + newH_=oldH_.duplicate(); + } + return newH_; + + } +} Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheModel.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -143,7 +143,8 @@ /** * methode qui permet de dupliquer les models de courbe + * @param _duplicator TODO */ - public EGGrapheModel duplicate(); + public EGGrapheModel duplicate(EGGrapheDuplicator _duplicator); } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheSimpleModel.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -756,33 +756,35 @@ } - public EGGrapheModel duplicate() { + //TODO a reprendre + public EGGrapheModel duplicate(EGGrapheDuplicator _duplicator) { //--duplication de la liste des courbes --// - ArrayList<EGCourbeSimple> listeElements = new ArrayList<EGCourbeSimple>(); + ArrayList<EGCourbeSimple> listeElements = new ArrayList<EGCourbeSimple>(element_.size()); for (Iterator<EGCourbeSimple> it = this.element_.iterator(); it.hasNext();) { EGCourbeSimple courbe = it.next(); - listeElements.add((EGCourbeSimple) courbe.duplicate()); + listeElements.add((EGCourbeSimple) courbe.duplicate(this,_duplicator)); } EGGrapheSimpleModel duplic = new EGGrapheSimpleModel((EGCourbeSimple[]) listeElements.toArray()); - + //a corriger duplic.axeX_ = this.axeX_.duplicate(); // duplication du listselectionModel - try { - duplic.selection_ = (DefaultListSelectionModel) this.selection_.clone(); - } catch (CloneNotSupportedException e) { - +// try { +// duplic.selection_ = (DefaultListSelectionModel) this.selection_.clone(); +// } catch (CloneNotSupportedException e) { + //TODO cela suffit bien // -- si ce n'est pas duplicable, en cree un par defaut --// duplic.selection_ = new DefaultListSelectionModel(); - } +// } // -- pas besoin de dupliquer le tableModel, il ne fait que gerer la liste // elements --// - duplic.tableModel_ = new SimpleTableModel(); + //FRED ok +// duplic.tableModel_ = new SimpleTableModel(); return duplic; Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -1064,7 +1064,9 @@ internFireCourbeChanged((EGObject) _path.getLastPathComponent()); } - public EGGrapheModel duplicate() { + + //TODO il faut dupliquer tous les groupes + public EGGrapheModel duplicate(EGGrapheDuplicator _duplicator) { EGGrapheTreeModel duplic = new EGGrapheTreeModel(); duplic.axeX_ = this.axeX_.duplicate(); duplic.selectionModel_.setSelectionMode(this.selectionModel_.getSelectionMode()); Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGroup.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGroup.java 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGroup.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -46,13 +46,12 @@ super(); comp_ = new ArrayList(10); } - - public EGGroup(List l) { - super(); - comp_ = l; - } - + // public EGGroup(List l) { + // super(); + // comp_ = l; + // } + private EGParent.TreeNodes getEgParent() { return n_; } @@ -74,17 +73,13 @@ } public boolean canDescendre(final EGObject _o) { - if (comp_.size() <= 1) { - return false; - } + if (comp_.size() <= 1) { return false; } final int idx = comp_.indexOf(_o); return idx >= 0 && idx < comp_.size() - 1; } public boolean canMonter(final EGObject _o) { - if (comp_.size() <= 1) { - return false; - } + if (comp_.size() <= 1) { return false; } return comp_.indexOf(_o) > 0; } @@ -104,9 +99,7 @@ * @param _idx l'indice d'ajout */ public void addEGComponent(final EGCourbeChild _i, final int _idx) { - if (comp_.contains(_i)) { - return; - } + if (comp_.contains(_i)) { return; } if (_i.getParentGroup() != null) { _i.getParentGroup().removeEGComponent(_i); } @@ -130,9 +123,7 @@ } public boolean ajuste(final CtuluRange _x, final CtuluRange _y) { - if (comp_.size() == 0) { - return false; - } + if (comp_.size() == 0) { return false; } boolean r = false; for (final Iterator it = comp_.iterator(); it.hasNext();) { final EGCourbeChild c = (EGCourbeChild) it.next(); @@ -144,9 +135,7 @@ } public boolean ajusteX(final CtuluRange _x) { - if (comp_.size() == 0) { - return false; - } + if (comp_.size() == 0) { return false; } boolean r = false; for (final Iterator it = comp_.iterator(); it.hasNext();) { final EGCourbeChild c = (EGCourbeChild) it.next(); @@ -158,9 +147,7 @@ } public boolean ajusteY(final CtuluRange _y) { - if (comp_.size() == 0) { - return false; - } + if (comp_.size() == 0) { return false; } boolean r = false; for (final Iterator it = comp_.iterator(); it.hasNext();) { final EGCourbeChild c = (EGCourbeChild) it.next(); @@ -199,9 +186,7 @@ } public void dessine(final Graphics2D _g, final EGRepere _f) { - if (!isVisible_ || !isAtLeastOneObjectVisible()) { - return; - } + if (!isVisible_ || !isAtLeastOneObjectVisible()) { return; } final Color old = _g.getColor(); _g.setColor(Color.black); final int nbElement = this.comp_.size(); @@ -360,7 +345,8 @@ if (Double.isNaN(x.max_)) { x.max_ = 0; /* - * if (x.min == x.max) { if (x.min != 0) { x.min = x.min * 0.9; x.max = x.max * 1.1; } else { x.max = 1; } } + * if (x.min == x.max) { if (x.min != 0) { x.min = x.min 0.9; x.max = + * x.max 1.1; } else { x.max = 1; } } */ } } else { @@ -386,16 +372,15 @@ x.max_ = 0; } /* - * if (x.min == x.max) { if (x.min != 0) { x.min = x.min * 0.9; x.max = x.max * 1.1; } else { x.max = 1; } } + * if (x.min == x.max) { if (x.min != 0) { x.min = x.min 0.9; x.max = x.max + * 1.1; } else { x.max = 1; } } */ return x; } public boolean isAtLeastOneObjectVisible() { for (int i = getChildCount() - 1; i >= 0; i--) { - if (getCourbe(i).isVisible_) { - return true; - } + if (getCourbe(i).isVisible_) { return true; } } return false; } @@ -454,9 +439,7 @@ * @param _i la courbe a enelever */ public void removeEGComponent(final EGCourbeChild _i) { - if (!comp_.contains(_i)) { - return; - } + if (!comp_.contains(_i)) { return; } comp_.remove(_i); _i.setParentGroup(null); } @@ -464,9 +447,7 @@ public void removeEGComponent(final List _list) { for (final Iterator it = _list.iterator(); it.hasNext();) { final EGCourbeChild i = (EGCourbeChild) it.next(); - if (!comp_.contains(i)) { - return; - } + if (!comp_.contains(i)) { return; } comp_.remove(i); i.setParentGroup(null); } @@ -509,37 +490,24 @@ public String toString() { return EbliLib.getS("Groupe") + CtuluLibString.ESPACE + title_; } - - public EGGroup duplicate() { - - - //-- duplication de comp --// - - ArrayList liste = new ArrayList(this.comp_.size()); - for(Iterator it=this.comp_.iterator();it.hasNext();){ - Object item=it.next(); - if (item instanceof EGCourbeChild) { - - // -- !!! reccurence !!! egcourbechild se duplique provoquqnt la - // duplication de eggroup et ainsi de suite --// - liste.add(((EGCourbeChild) item).duplicate()); - }else - // FIXME: adrien si c est pas instance de egcourbeChild, c estquoi ??? - // dans ce cas on duplique ?? - liste.add(item); - - } - + + // TODO a continuer + public EGGroup duplicate(EGGrapheDuplicator _duplicator) { + // -- duplication de l objet --// - EGGroup duplic = new EGGroup(liste); + EGGroup duplic = new EGGroup(); duplic.isVisible_ = this.isVisible_; duplic.title_ = this.title_; duplic.n_ = this.n_; duplic.y_ = this.y_.duplicate(); - - + for (Iterator it = this.comp_.iterator(); it.hasNext();) { + Object item = it.next(); + if (item instanceof EGCourbeChild) { + duplic.addEGComponent((EGCourbeChild)((EGCourbeChild) item).duplicate(duplic,_duplicator)); + } + + } + return duplic; } - - } \ No newline at end of file Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java 2008-08-18 13:33:11 UTC (rev 3822) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGRepere.java 2008-08-18 14:10:54 UTC (rev 3823) @@ -115,7 +115,7 @@ } - public EGRepere duplicate() { + public EGRepere duplicate(EGGrapheDuplicator _duplicator) { EGRepere duplic = new EGRepere(); duplic.h_ = this.h_; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <had...@us...> - 2009-01-20 19:33:56
|
Revision: 4385 http://fudaa.svn.sourceforge.net/fudaa/?rev=4385&view=rev Author: hadouxad Date: 2009-01-20 19:33:53 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Modified Paths: -------------- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionReplayDataCourbe.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionReplayDataCourbe.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionReplayDataCourbe.java 2009-01-20 09:46:41 UTC (rev 4384) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGActionReplayDataCourbe.java 2009-01-20 19:33:53 UTC (rev 4385) @@ -67,6 +67,9 @@ modelSelectionne.replayData(treemodel_,new HashMap(),impl_); + //-- on restore les donn\xE9es --// + panelGraphe_.getGraphe().restore(); + panelGraphe_.getGraphe().axeUpdated(); } Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2009-01-20 09:46:41 UTC (rev 4384) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGGrapheTreeModel.java 2009-01-20 19:33:53 UTC (rev 4385) @@ -998,6 +998,9 @@ } return r.indexOf(_o) > 0; } + + + public void removeCurves(final EGCourbeChild[] _cs, final CtuluCommandContainer _mng) { if (!canDeleteCourbes()) { Modified: branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java =================================================================== --- branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java 2009-01-20 09:46:41 UTC (rev 4384) +++ branches/Prepro-0.92-SNAPSHOT/ebli/src/org/fudaa/ebli/courbe/EGSpecificActions.java 2009-01-20 19:33:53 UTC (rev 4385) @@ -22,6 +22,7 @@ import org.fudaa.ebli.commun.EbliActionInterface; import org.fudaa.ebli.commun.EbliLib; import org.fudaa.ebli.ressource.EbliResource; +import org.fudaa.ebli.visuallibrary.EbliWidget; import com.memoire.bu.BuResource; import com.memoire.bu.BuSeparator; @@ -134,13 +135,14 @@ menu_.addMenuItem(EbliResource.EBLI.getString("Courbe classique"), "NUAGE_POINTS", BuResource.BU .getIcon("crystal_oscilloscope"), true, this); + if(EbliWidget.AMELIO_LOT_VISIBLE){ //-- action origine de la courbe. --// menu_.add(new EGActionAfficheOrigineCourbe.CourbeOnly(courbe.getModel(),ui_)); //-- action replay data --// // menu_.add(new EGActionReplayDataCourbe.CourbeOnly(courbe.getModel(),ui_)); + } - if(target_.getModel().getSpecificsActionsCurvesOnly(target_,ui_)!=null) for(EbliActionInterface action:target_.getModel().getSpecificsActionsCurvesOnly(target_,ui_)) menu_.add(action); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |