1   package fi.jyu.mit.graphics;
2   
3   /**
4    * Luokka jolla voi helposti luoda kuviota avaruuteen.
5    * Avaruuteen voi lisätä kuvioita, esimerkiksi
6    * <pre>
7    *      space.addLine(0,0,100,100).setColor(Color.RED);
8    *      space.addCircle(0, 0, 1).setColor(Color.RED);
9    *      space.addShape(new Line(0, 0, 10, 10)).setColor(Color.RED);
10   * </pre>
11   * @author Markus Kivioja
12   *
13   */
14  public class EasySpace extends Space implements Easy {
15      
16      private static final long serialVersionUID = 1;
17      
18      /**
19       * Luo uuden avaruuden
20       *
21       */
22      public EasySpace() {
23          super();
24      }
25      
26      public Drawable addShape(Drawable shape) {
27          return add(shape);
28      }
29      
30      public Line addLine(double x1, double y1, double x2, double y2) {
31          return (Line)add(new Line(x1, y1, x2, y2));
32      }
33      
34      public Line addLine(double x1, double y1, double z1, double x2, double y2, double z2) {
35          return (Line)add(new Line(x1, y1, z1, x2, y2, z2));
36      }
37      
38      public Circle addCircle(double x, double y, double r) {
39          return (Circle)add(new Circle(x, y, r));
40      }
41      
42      public Circle addCircle(double x, double y, double z, double r) {
43          return (Circle)add(new Circle(x, y, z, r));
44      }
45      
46      public Polygon addPolygon(double[] xpoints, double[] ypoints) {
47          return (Polygon)add(new Polygon(xpoints, ypoints));
48      }
49  
50      public Polygon addPolygon(double[][] points) {
51          return (Polygon)add(new Polygon(points));
52      }
53  
54      public Axis addAxis(double xLength, double yLength, double zLength) {
55          return (Axis)add(new Axis(xLength, yLength, zLength));
56      }
57      
58      public Axis addAxis(double xLength, double yLength, double zLength, double x, double y, double z) {
59          return (Axis)add(new Axis(xLength, yLength, zLength, x, y, z));
60      }
61      
62      public FillPolygon addFillPolygon(double[] xpoints, double[] ypoints) {
63          return (FillPolygon)add(new FillPolygon(xpoints, ypoints));
64      }
65  
66      public FillPolygon addFillPolygon(double[][] points) {
67          return (FillPolygon)add(new FillPolygon(points));
68      }
69  }
70  
71