|
From: Frederic D. <de...@us...> - 2004-06-11 16:38:37
|
Update of /cvsroot/fudaa/fudaa_devel/ebli/src/org/fudaa/ebli/trace In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5340/src/org/fudaa/ebli/trace Modified Files: TraceIcone.java TraceLigne.java Log Message: Maj calque segment Index: TraceIcone.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/ebli/src/org/fudaa/ebli/trace/TraceIcone.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TraceIcone.java 19 Dec 2003 12:06:42 -0000 1.6 --- TraceIcone.java 11 Jun 2004 16:38:27 -0000 1.7 *************** *** 8,11 **** --- 8,12 ---- */ package org.fudaa.ebli.trace; + import java.awt.*; import java.awt.geom.Line2D; *************** *** 15,135 **** /** * Une classe de trace de points. ! * ! * @version $Revision$ $Date$ b_y $Author$ ! * @author A_xel von Arnim */ public class TraceIcone implements Icon { ! public final static int RIEN= 0; ! public final static int POINT= 1; ! public final static int PLUS= 2; ! public final static int CROIX= 3; ! public final static int CARRE= 4; ! public final static int CARRE_PLEIN= 5; ! public final static int LOSANGE= 6; ! public final static int CERCLE= 7; ! public final static int DISQUE= 8; protected int type_; protected int taille_; private Color couleur_; public TraceIcone() { this(TracePoint.POINT, 1); } public TraceIcone(int _type, int _taille) { ! type_= _type; ! taille_= _taille; } public void type(int _type) { ! type_= _type; } public int type() { return type_; } /** ! * Correspond a la taille/2 de l'icone */ public void taille(int _taille) { ! taille_= _taille; } /** ! * Correspond a la taille/2 de l'icone */ public int taille() { return taille_; } public void couleur(Color _couleur) { ! couleur_= _couleur; } public Color couleur() { return couleur_; } public int getIconWidth() { ! return 2 * taille_; } public int getIconHeight() { ! return 2 * taille_; } public void paintIcon(Component _c, Graphics _g, double _x, double _y) { ! paintIcon(_c, _g, (int)_x, (int)_y); } public void paintIcon(Component _c, Graphics _g, int _x, int _y) { ! Color old= null; if (couleur_ != null) { ! old= _g.getColor(); _g.setColor(couleur_); } switch (type_) { ! case RIEN : ! break; ! case POINT : ! _g.drawLine(_x, _y, _x, _y); ! break; ! case PLUS : ! _g.drawLine(_x - taille_, _y, _x + taille_, _y); ! _g.drawLine(_x, _y - taille_, _x, _y + taille_); ! break; ! case CROIX : ! _g.drawLine(_x - taille_, _y - taille_, _x + taille_, _y + taille_); ! _g.drawLine(_x + taille_, _y - taille_, _x - taille_, _y + taille_); ! break; ! case CARRE : ! _g.drawRect( ! _x - taille_, ! _y - taille_, ! 2 * taille_ - 1, ! 2 * taille_ - 1); ! break; ! case CARRE_PLEIN : ! _g.fillRect( ! _x - taille_, ! _y - taille_, ! 2 * taille_ - 1, ! 2 * taille_ - 1); ! break; ! case LOSANGE : ! _g.drawLine(_x - taille_, _y, _x, _y - taille_); ! _g.drawLine(_x, _y - taille_, _x + taille_, _y); ! _g.drawLine(_x + taille_, _y, _x, _y + taille_); ! _g.drawLine(_x, _y + taille_, _x - taille_, _y); ! break; ! case CERCLE : ! _g.drawArc( ! _x - taille_, ! _y - taille_, ! 2 * taille_ + 1, ! 2 * taille_ + 1, ! 0, ! 360); ! break; ! case DISQUE : ! _g.fillArc( ! _x - taille_, ! _y - taille_, ! 2 * taille_ + 1, ! 2 * taille_ + 1, ! 0, ! 360); ! break; ! default : ! break; } if (couleur_ != null) { --- 16,129 ---- /** * Une classe de trace de points. ! * ! * @version $Revision$ $Date$ b_y $Author$ ! * @author A_xel von Arnim */ public class TraceIcone implements Icon { ! ! public final static int RIEN = 0; ! public final static int POINT = 1; ! public final static int PLUS = 2; ! public final static int CROIX = 3; ! public final static int CARRE = 4; ! public final static int CARRE_PLEIN = 5; ! public final static int LOSANGE = 6; ! public final static int CERCLE = 7; ! public final static int DISQUE = 8; protected int type_; protected int taille_; private Color couleur_; + public TraceIcone() { this(TracePoint.POINT, 1); } + public TraceIcone(int _type, int _taille) { ! type_ = _type; ! taille_ = _taille; } + public void type(int _type) { ! type_ = _type; } + public int type() { return type_; } + /** ! * Correspond a la taille/2 de l'icone */ public void taille(int _taille) { ! taille_ = _taille; } + /** ! * Correspond a la taille/2 de l'icone */ public int taille() { return taille_; } + public void couleur(Color _couleur) { ! couleur_ = _couleur; } + public Color couleur() { return couleur_; } + public int getIconWidth() { ! return type_ == POINT ? 1 : 2 * taille_; } + public int getIconHeight() { ! return type_ == POINT ? 1 : 2 * taille_; } + public void paintIcon(Component _c, Graphics _g, double _x, double _y) { ! paintIcon(_c, _g, (int) _x, (int) _y); } + public void paintIcon(Component _c, Graphics _g, int _x, int _y) { ! Color old = null; if (couleur_ != null) { ! old = _g.getColor(); _g.setColor(couleur_); } switch (type_) { ! case RIEN: ! break; ! case POINT: ! _g.drawLine(_x, _y, _x, _y); ! break; ! case PLUS: ! _g.drawLine(_x - taille_, _y, _x + taille_, _y); ! _g.drawLine(_x, _y - taille_, _x, _y + taille_); ! break; ! case CROIX: ! _g.drawLine(_x - taille_, _y - taille_, _x + taille_, _y + taille_); ! _g.drawLine(_x + taille_, _y - taille_, _x - taille_, _y + taille_); ! break; ! case CARRE: ! _g.drawRect(_x - taille_, _y - taille_, 2 * taille_ - 1, 2 * taille_ - 1); ! break; ! case CARRE_PLEIN: ! _g.fillRect(_x - taille_, _y - taille_, 2 * taille_ - 1, 2 * taille_ - 1); ! break; ! case LOSANGE: ! _g.drawLine(_x - taille_, _y, _x, _y - taille_); ! _g.drawLine(_x, _y - taille_, _x + taille_, _y); ! _g.drawLine(_x + taille_, _y, _x, _y + taille_); ! _g.drawLine(_x, _y + taille_, _x - taille_, _y); ! break; ! case CERCLE: ! _g.drawArc(_x - taille_, _y - taille_, 2 * taille_ + 1, 2 * taille_ + 1, 0, 360); ! break; ! case DISQUE: ! _g.fillArc(_x - taille_, _y - taille_, 2 * taille_ + 1, 2 * taille_ + 1, 0, 360); ! break; ! default: ! break; } if (couleur_ != null) { *************** *** 137,139 **** } } ! } --- 131,133 ---- } } ! } \ No newline at end of file Index: TraceLigne.java =================================================================== RCS file: /cvsroot/fudaa/fudaa_devel/ebli/src/org/fudaa/ebli/trace/TraceLigne.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TraceLigne.java 25 Nov 2003 10:06:48 -0000 1.7 --- TraceLigne.java 11 Jun 2004 16:38:27 -0000 1.8 *************** *** 8,11 **** --- 8,12 ---- */ package org.fudaa.ebli.trace; + import java.awt.*; import java.awt.geom.CubicCurve2D; *************** *** 17,66 **** /** * Une classe de trace de lignes. [...1440 lines suppressed...] ! * private void bresenham(int x1, int y1, int x2, int y2, BresenhamParams bp) { int xprec=x1; int ! * yprec=y1; int c, deltaX, deltaY, x, y, incrX, incrY, i; deltaX=Math.abs(x2-x1); ! * deltaY=Math.abs(y2-y1); if( (y2-y1)>0 ) incrY=1; else incrY=-1; if( (x2-x1)>0 ) incrX=1; else ! * incrX=-1; if( deltaX>deltaY ) { c=2*deltaY-deltaX; y=y1; x=x1; for(i=0; i <deltaX; i++) { if( ! * bp.trait ) { if( bp.count <bp.lgTrait ) { g_.drawLine(xprec, yprec, x, y); bp.count++; } else { ! * bp.count=0; bp.trait=false; } } else { if( bp.count <bp.lgVide ) bp.count++; else { bp.count=0; ! * xprec=x; yprec=y; bp.trait=true; } } x+=incrX; if( c <0 ) c+=(2*deltaY); else { y+=incrY; ! * c+=(2*deltaY-2*deltaX); } } } else { c=2*deltaX-deltaY; x=x1; y=y1; for(i=0; i <deltaY; i++) { ! * if( bp.trait ) { if( bp.count <bp.lgTrait ) { g_.drawLine(xprec, yprec, x, y); bp.count++; } ! * else { bp.trait=false; bp.count=0; } } else { if( bp.count <bp.lgVide ) bp.count++; else { ! * bp.count=0; xprec=x; yprec=y; bp.trait=true; } } y+=incrY; if( c <0 ) c+=(2*deltaX); else { ! * x+=incrX; c+=(2*deltaX-2*deltaY); } } } } */ } /** Structure de donnees pour l'algorithme de Bresenham. */ /* ! * class BresenhamParams { public int lgTrait, lgVide; public int count; public boolean trait; ! * public BresenhamParams(int _lgTrait, int _lgVide) { lgTrait=_lgTrait; lgVide=_lgVide; count=0; ! * trait=true; } } */ |