예제 #1
0
 public void addNew(string s, int dx, int dy, int w, int h)
 // public void add(Shape value)
 {
     if (s == "Круг")
     {
         var t = new Krug(dx, dy);
         if (t.check(w, h))
         {
             var node = new Node(t);
             if (Head == null)
             {
                 Head = node;
             }
             else
             {
                 Tail.next = node;
             }
             Tail    = node;
             current = Tail;
             count  += 1;
         }
     }
     else if (s == "Треугольник")
     {
         var t = new triangle(dx, dy);
         if (t.check(w, h))
         {
             var node = new Node(t);
             if (Head == null)
             {
                 Head = node;
             }
             else
             {
                 Tail.next = node;
             }
             Tail    = node;
             current = Tail;
             count  += 1;
         }
     }
     else
     {
         var t = new square(dx, dy);
         if (t.check(w, h))
         {
             var node = new Node(t);
             if (Head == null)
             {
                 Head = node;
             }
             else
             {
                 Tail.next = node;
             }
             Tail    = node;
             current = Tail;
             count  += 1;
         }
     }
 }