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