package org.CG.drawings;

import java.util.LinkedList;
import javax.media.opengl.GL;
import org.CG.infrastructure.Drawing;

/**
 *
 * @author ldavid
 */
public class Polygon extends Drawing {

    LinkedList<int[]> points;

    public Polygon() {
        super();

        finished = false;
        points = new LinkedList<>();
    }
    
    @Override
    public Drawing setStart(int[] start) {
        points.add(start);
        return super.setStart(start);
    }
    
    @Override
    public Drawing translate(int[] point) {
        point[0] -= start[0];
        point[1] -= start[1];

        points.stream().forEach((p) -> {
            p[0] += point[0];
            p[1] += point[1];
        });

        return this;
    }
    
    @Override
    public void updateLastCoordinateInputted(int[] point) {
        points.removeLast();
        points.add(point);
    }

    @Override
    public void draw(GL gl) {
        gl.glColor3ub(color[0], color[1], color[2]);
        gl.glBegin(GL.GL_POLYGON);

        points.stream().forEach((point) -> {
            gl.glVertex2i(point[0], point[1]);
        });

        gl.glEnd();
    }
}

@@ -205,20 +205,18 @@
 ist%3C
+L
 in
-t%5B%5D%3E point
+e%3E edge
 s;%0A%0A
@@ -290,21 +290,20 @@
         
-point
+edge
 s = new 
@@ -394,26 +394,41 @@
         
-points.add
+edges.add(Line().setStart
 (start);
@@ -539,183 +539,8 @@
 ) %7B%0A
-        point%5B0%5D -= start%5B0%5D;%0A        point%5B1%5D -= start%5B1%5D;%0A%0A        points.stream().forEach((p) -%3E %7B%0A            p%5B0%5D += point%5B0%5D;%0A            p%5B1%5D += point%5B1%5D;%0A        %7D);%0A%0A
     
@@ -653,46 +653,51 @@
     
-points.removeLast();%0A        points.ad
+edges.getLast().updateLastCoordinateInputte
 d(po
@@ -765,102 +765,12 @@
     
-gl.glColor3ub(color%5B0%5D, color%5B1%5D, color%5B2%5D);%0A        gl.glBegin(GL.GL_POLYGON);%0A%0A        point
+edge
 s.st
@@ -785,21 +785,20 @@
 orEach((
-point
+edge
 ) -%3E %7B%0A 
@@ -812,73 +812,32 @@
     
-gl.glVertex2i(point%5B0%5D, point%5B1%5D);%0A        %7D);%0A%0A        gl.glEnd(
+edge.draw(gl);%0A        %7D
 );%0A 
@@ -843,8 +843,12 @@
     %7D%0A%7D%0A
+(((%0A

Update Polygon.java