TP2: Fix one test case.
[TP_POO.git] / TP2 / Main.java
CommitLineData
4871c009 1
4871c009
JB
2class Main {
3
b026092f 4 private static void main1() {
14d4fd0d
JB
5 Point p1 = new Point(1, 2);
6 Point p2 = new Point(2, 7);
f8ac3cd5
JB
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);
14d4fd0d 11 Piletransformations trans = new Piletransformations(10);
b026092f 12
f8ac3cd5 13 boolean rt = trans.empiler(p4);
60945b41
JB
14 if (!rt) {
15 System.out.println("Echec empilation");
16 }
14d4fd0d 17
14d4fd0d
JB
18 segment.dessiner(trans);
19 cercle.dessiner(trans);
20
b026092f
JB
21 Point p5 = new Point(3, 5);
22 segment.deplacer(p5);
23 cercle.deplacer(p5);
24
f8ac3cd5
JB
25 Image image = new Image();
26 image.ajouter(segment);
27 image.ajouter(cercle);
28 image.dessiner(trans);
b026092f
JB
29 image.deplacer(p5);
30 image.dessiner(trans);
31
32 trans.depiler();
33 }
34
35 private static void main2() {
36 Point p1 = new Point(1, 2);
37 Point p2 = new Point(2, 7);
38 Segment segment1 = new Segment(p1, p2);
39 Point p3 = new Point(1, 5);
40 Point p4 = new Point(3, 1);
41 Segment segment2 = new Segment(p3, p4);
42 Point p5 = new Point(4, 5);
43 Cercle cercle1 = new Cercle(p5, 5.2);
44 Point p6 = new Point(5, 4);
45 Cercle cercle2 = new Cercle(p6, 4.3);
46 Point point1 = new Point(8, -1.5);
47 Image image1 = new Image();
48 Image image2 = new Image();
49 Image image3 = new Image();
50 Piletransformations transformations = new Piletransformations(10);
51
52 transformations.empiler(point1);
53 image1.ajouter(segment1);
54 image1.ajouter(cercle1);
55 image2.ajouter(segment2);
56 image2.ajouter(cercle2);
57 image1.dessiner(transformations);
58 image2.dessiner(transformations);
59 Point point2 = new Point(0.5, 2.5);
60 image1.deplacer(point2);
60945b41
JB
61 image3.ajouter(image1);
62 image3.ajouter(image2);
63 image3.dessiner(transformations);
b026092f
JB
64 transformations.depiler();
65 }
66
67 public static void main(String[] args) {
68
69 main2();
70
4871c009
JB
71 }
72
73}