Commit | Line | Data |
---|---|---|
c05c2289 JB |
1 | |
2 | class Segment extends Forme { | |
3 | private Point pDest; | |
4 | ||
5 | /* Segment() { | |
6 | pOri = null; | |
7 | pDest = null; | |
8 | } */ | |
9 | ||
10 | Segment(Point pO, Point pD) { | |
11 | super(pO); | |
12 | pDest = pD; | |
13 | } | |
14 | ||
15 | public void dessiner(Piletransformations pile) { | |
16 | String className = this.getClass().getSimpleName(); | |
17 | Point pTrans = pile.getCurrentTransformation(); | |
18 | Point pOriTrans = super.getpOri().additionner(pTrans); | |
19 | Point pDestTrans = pDest.additionner(pTrans); | |
20 | System.out.println(className + " " + super.getpOri().toString()+ "->" + pOriTrans.toString() + " " + | |
21 | pDest.toString() + "->" + pDestTrans.toString()); | |
22 | } | |
23 | ||
24 | public void deplacer(Point p) { | |
25 | super.deplacer(p); | |
26 | pDest = pDest.additionner(p); | |
27 | } | |
28 | ||
29 | public void afficher() { | |
30 | String className = this.getClass().getSimpleName(); | |
31 | System.out.println("---- " + className + " ----"); | |
32 | System.out.println(super.getpOri().toString() + " " + pDest.toString()); | |
33 | } | |
34 | ||
35 | } |