public void add(string s, int dx, int dy) // public void add(Shape value) { if (s == "Круг") { var t = new Krug(dx, dy); var node = new Node(t); if (Head == null) { Head = node; } else { Tail.next = node; } Tail = node; current = Tail; } else if (s == "Треугольник") { var t = new triangle(dx, dy); var node = new Node(t); if (Head == null) { Head = node; } else { Tail.next = node; } Tail = node; current = Tail; } else { var t = new square(dx, dy); var node = new Node(t); if (Head == null) { Head = node; } else { Tail.next = node; } Tail = node; current = Tail; } count++; }
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; } } }