TP2: add class annotations.
[TP_POO.git] / TP2 / Segment.java
CommitLineData
4871c009 1
78c725c5
JB
2@ClassPreamble (
3 author = "Jérôme Benoit",
4 date = "04/25/2014"
5)
bd443eec 6class Segment extends Forme {
4871c009
JB
7 private Point pDest;
8
9 /* Segment() {
10 pOri = null;
11 pDest = null;
12 } */
13
14 Segment(Point pO, Point pD) {
009c5b1e 15 super(pO);
4871c009
JB
16 pDest = pD;
17 }
18
14d4fd0d
JB
19 public void dessiner(Piletransformations pile) {
20 String className = this.getClass().getSimpleName();
21 Point pTrans = pile.getCurrentTransformation();
009c5b1e 22 Point pOriTrans = super.getpOri().additionner(pTrans);
14d4fd0d 23 Point pDestTrans = pDest.additionner(pTrans);
009c5b1e 24 System.out.println(className + " " + super.getpOri().toString()+ "->" + pOriTrans.toString() + " " +
f8ac3cd5 25 pDest.toString() + "->" + pDestTrans.toString());
4871c009
JB
26 }
27
14d4fd0d 28 public void deplacer(Point p) {
009c5b1e 29 super.deplacer(p);
14d4fd0d 30 pDest = pDest.additionner(p);
4871c009
JB
31 }
32
54d3f5b3 33 public void afficher() {
c7c510eb
JB
34 String className = this.getClass().getSimpleName();
35 System.out.println("---- " + className + " ----");
54d3f5b3
JB
36 System.out.println(super.getpOri().toString() + " " + pDest.toString());
37 }
38
4871c009 39}