From: Jérôme Benoit Date: Wed, 14 Feb 2018 11:16:02 +0000 (+0100) Subject: Add the basic code for Image handling. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a988a46e0446d611bf97c2c6b1288a1befd2d4a7;p=TP_POO.git Add the basic code for Image handling. Signed-off-by: Jérôme Benoit --- diff --git a/TP2/Image.java b/TP2/Image.java new file mode 100644 index 0000000..807e11b --- /dev/null +++ b/TP2/Image.java @@ -0,0 +1,44 @@ + +class Image extends Forme { + final int IMAGE_MAX_SIZE = 100; + Point pOri; + Forme[] formeCollection; + int formeNumber; + + Image() { + pOri = new Point(); + formeCollection = new Forme[IMAGE_MAX_SIZE]; + formeNumber = 0; + } + + Image(Point p) { + pOri = p; + formeCollection = new Forme[IMAGE_MAX_SIZE]; + formeNumber = 0; + } + + private boolean isEmpty() { + return (formeNumber == 0); + } + + private boolean isFull() { + return (formeNumber >= formeCollection.length); + } + + public void dessiner(Piletransformations pile) { + for (int i = 0; i < formeNumber; i++) { + formeCollection[i].dessiner(pile); + } + } + + public void deplacer(Point p) { + for (int i = 0; i < formeNumber; i++) { + formeCollection[i].deplacer(p); + } + } + + public boolean ajouter(Forme forme) { + return false; + } + +} diff --git a/TP2/Makefile b/TP2/Makefile index 14f1b59..41023ff 100644 --- a/TP2/Makefile +++ b/TP2/Makefile @@ -48,6 +48,7 @@ JVM = java CLASSES = \ Point.java \ Forme.java \ + Image.java \ Segment.java \ Cercle.java \ Piletransformations.java \