| 1 | |
| 2 | class Main { |
| 3 | |
| 4 | private static void main1() { |
| 5 | Point p1 = new Point(1, 2); |
| 6 | Point p2 = new Point(2, 7); |
| 7 | Segment segment = new Segment(p1, p2); |
| 8 | Point p3 = new Point(4, 5); |
| 9 | Cercle cercle = new Cercle(p3, 5.2); |
| 10 | Point p4 = new Point(2, 3); |
| 11 | Piletransformations trans = new Piletransformations(10); |
| 12 | |
| 13 | boolean rt = trans.empiler(p4); |
| 14 | |
| 15 | segment.dessiner(trans); |
| 16 | cercle.dessiner(trans); |
| 17 | |
| 18 | Point p5 = new Point(3, 5); |
| 19 | segment.deplacer(p5); |
| 20 | cercle.deplacer(p5); |
| 21 | |
| 22 | Image image = new Image(); |
| 23 | image.ajouter(segment); |
| 24 | image.ajouter(cercle); |
| 25 | image.dessiner(trans); |
| 26 | image.deplacer(p5); |
| 27 | image.dessiner(trans); |
| 28 | |
| 29 | trans.depiler(); |
| 30 | } |
| 31 | |
| 32 | private static void main2() { |
| 33 | Point p1 = new Point(1, 2); |
| 34 | Point p2 = new Point(2, 7); |
| 35 | Segment segment1 = new Segment(p1, p2); |
| 36 | Point p3 = new Point(1, 5); |
| 37 | Point p4 = new Point(3, 1); |
| 38 | Segment segment2 = new Segment(p3, p4); |
| 39 | Point p5 = new Point(4, 5); |
| 40 | Cercle cercle1 = new Cercle(p5, 5.2); |
| 41 | Point p6 = new Point(5, 4); |
| 42 | Cercle cercle2 = new Cercle(p6, 4.3); |
| 43 | Point point1 = new Point(8, -1.5); |
| 44 | Image image1 = new Image(); |
| 45 | Image image2 = new Image(); |
| 46 | Image image3 = new Image(); |
| 47 | Piletransformations transformations = new Piletransformations(10); |
| 48 | |
| 49 | transformations.empiler(point1); |
| 50 | image1.ajouter(segment1); |
| 51 | image1.ajouter(cercle1); |
| 52 | image2.ajouter(segment2); |
| 53 | image2.ajouter(cercle2); |
| 54 | image1.dessiner(transformations); |
| 55 | image2.dessiner(transformations); |
| 56 | Point point2 = new Point(0.5, 2.5); |
| 57 | image1.deplacer(point2); |
| 58 | image2.ajouter(image1); |
| 59 | image2.dessiner(transformations); |
| 60 | transformations.depiler(); |
| 61 | } |
| 62 | |
| 63 | public static void main(String[] args) { |
| 64 | |
| 65 | main2(); |
| 66 | |
| 67 | } |
| 68 | |
| 69 | } |