Add the abstract class Forme that Cercle and Segment extend.
[TP_POO.git] / TP2 / Cercle.java
index 4bf743ffdee026a698b25de263e8df57eaaaf3b6..f13be696a5bd3966dd1226c0de8a53524cd22fac 100644 (file)
@@ -1,5 +1,5 @@
 
-class Cercle {
+class Cercle extends Forme {
     private Point pOri;
     private double rayon;
 
@@ -8,12 +8,15 @@ class Cercle {
         rayon = r;
     }
 
-    void dessiner(Piletransformations pile) {
-
+    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);
     }
 
-    void deplacer(Point p) {
-
+    public void deplacer(Point p) {
+        pOri = pOri.additionner(p);
     }
-    
+
 }