class Cercle extends Forme {
- private Point pOri;
private double rayon;
Cercle(Point pO, double r) {
- pOri = pO;
+ super(pO);
rayon = r;
}
public void dessiner(Piletransformations pile) {
String className = this.getClass().getSimpleName();
Point pTrans = pile.getCurrentTransformation();
- Point pOriTrans = pOri.additionner(pTrans);
- System.out.println(className + " " + pOri.toString() + "->" + pOriTrans.toString() + " " + rayon);
- }
-
- public void deplacer(Point p) {
- pOri = pOri.additionner(p);
+ Point pOriTrans = super.getpOri().additionner(pTrans);
+ System.out.println(className + " " + super.getpOri().toString() + "->" + pOriTrans.toString() + " " + rayon);
}
}
-abstract class Forme {
+public abstract class Forme {
+ private Point pOri;
- abstract public void dessiner(Piletransformations pile);
- abstract public void deplacer(Point p);
+ public abstract void dessiner(Piletransformations pile);
+ Forme() {
+ pOri = new Point();
+ }
+
+ Forme(Point p) {
+ pOri = p;
+ }
+
+ public Point getpOri() {
+ return pOri;
+ }
+
+ public void deplacer(Point p) {
+ pOri = pOri.additionner(p);
+ }
}
class Image extends Forme {
final int IMAGE_MAX_SIZE = 100;
- Point pOri;
Forme[] formeCollection;
int formeNumber;
Image() {
- pOri = new Point();
+ super();
formeCollection = new Forme[IMAGE_MAX_SIZE];
formeNumber = 0;
}
Image(Point p) {
- pOri = p;
+ super(p);
formeCollection = new Forme[IMAGE_MAX_SIZE];
formeNumber = 0;
}
class Segment extends Forme {
- private Point pOri;
private Point pDest;
/* Segment() {
} */
Segment(Point pO, Point pD) {
- pOri = pO;
+ super(pO);
pDest = pD;
}
public void dessiner(Piletransformations pile) {
String className = this.getClass().getSimpleName();
Point pTrans = pile.getCurrentTransformation();
- Point pOriTrans = pOri.additionner(pTrans);
+ Point pOriTrans = super.getpOri().additionner(pTrans);
Point pDestTrans = pDest.additionner(pTrans);
- System.out.println(className + " " + pOri.toString()+ "->" + pOriTrans.toString() + " " +
+ System.out.println(className + " " + super.getpOri().toString()+ "->" + pOriTrans.toString() + " " +
pDest.toString() + "->" + pDestTrans.toString());
}
public void deplacer(Point p) {
- pOri = pOri.additionner(p);
+ super.deplacer(p);
pDest = pDest.additionner(p);
}