}\r
public static class ShapeExtention\r
{\r
+ public static void draw(this Shape drawee, double c)\r
+ {\r
+ drawee.draw( new Color(c) );\r
+ }\r
public static void draw(this Shape drawee, Color c)\r
{\r
Color tmp_col = drawee.fill;\r
color = c;\r
thick = t;\r
}\r
+ public static readonly Stroke null_line = new Stroke(Color.null_color, 0);\r
+ public static readonly Stroke hair_line = new Stroke(Color.white, 1);\r
}\r
\r
public partial class Line : Shape\r
set { begin = value; }\r
}\r
\r
+ //public static Line[] this[int x] { get { return Array(x); } }\r
+ //public static Line[,] this[int x, int y] { get { return Array(x, y); } }\r
+ public static Line[] Array(int ind)\r
+ {\r
+ Line[] l = new Line[ind];\r
+ for(int i=0; i<ind; i++) { l[i] = new Line(); }\r
+ return l;\r
+ }\r
+ public static Line[,] Array(int indx, int indy)\r
+ {\r
+ Line[,] l = new Line[indx, indy];\r
+ for (int i = 0; i < indx; i++) { for (int j = 0; j < indy; j++) { l[i, j] = new Line(); } }\r
+ return l;\r
+ }\r
+\r
+\r
+ public Line()\r
+ {\r
+ fill = Color.white;\r
+ stroke = Stroke.hair_line;\r
+ set(0,0,0,0);\r
+ }\r
public Line(double x1, double y1, double x2, double y2)\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.hair_line;\r
set(x1, y1, x2, y2);\r
}\r
public Line(Point v1, Point v2)\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.hair_line;\r
set(v1, v2);\r
}\r
- public void set(double x1, double y1, double x2, double y2)\r
+ public Line set(double x1, double y1, double x2, double y2)\r
{\r
begin.set(x1, y1);\r
end.set(x2, y2);\r
+ return this;\r
}\r
- public void set(Point v1, Point v2)\r
+ public Line set(Point v1, Point v2)\r
{\r
begin = v1;\r
end = v2;\r
+ return this;\r
}\r
\r
public Figure shift(Point p)\r
return this;\r
}\r
\r
- public void draw()\r
+ public virtual void draw()\r
{\r
Main.drawable.line(this);\r
}\r
{\r
public Point v1, v2;\r
\r
+ //public static Rectangle[] this[int x] { get { return Array(x); } }\r
+ //public static Rectangle[,] this[int x, int y] { get { return Array(x, y); } }\r
+ public static Rectangle[] Array(int ind)\r
+ {\r
+ Rectangle[] l = new Rectangle[ind];\r
+ for (int i = 0; i < ind; i++) { l[i] = new Rectangle(); }\r
+ return l;\r
+ }\r
+ public static Rectangle[,] Array(int indx, int indy)\r
+ {\r
+ Rectangle[,] l = new Rectangle[indx, indy];\r
+ for (int i = 0; i < indx; i++) { for (int j = 0; j < indy; j++) { l[i, j] = new Rectangle(); } }\r
+ return l;\r
+ }\r
+\r
+\r
public Rectangle()\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.null_line;\r
set(0,0);\r
}\r
public Rectangle(double wid, double hei)\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.null_line;\r
set(wid, hei);\r
}\r
public Rectangle(Rectangle another)\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.null_line;\r
v1 = another.v1;\r
v2 = another.v2;\r
}\r
set { double w = width, h = height; v1 = value; v2 = v1 + new Point(w,h); }\r
}\r
public Rectangle move_to(Point p) { datum = p; return this; }\r
- public Rectangle move_to(double x, double y, double z) { datum = new Point(x, y, z); return this; }\r
+ public Rectangle move_to(double x, double y, double z = 0.0) { datum = new Point(x, y, z); return this; }\r
public Rectangle locate(Point p) { datum = p; return this; }\r
- public Rectangle locate(double x, double y, double z) { datum = new Point(x, y, z); return this; }\r
+ public Rectangle locate(double x, double y, double z = 0.0) { datum = new Point(x, y, z); return this; }\r
\r
public Figure shift(Point p)\r
{\r
return this;\r
}\r
\r
- public void draw()\r
+ public virtual void draw()\r
{\r
Main.drawable.rect(this);\r
}\r
public Point datum { get; set; }\r
public double xdiameter, ydiameter;\r
\r
+ //public static Ellipse[] this[int x] { get { return Array(x); } }\r
+ //public static Ellipse[,] this[int x, int y] { get { return Array(x, y); } }\r
+ public static Ellipse[] Array(int ind)\r
+ {\r
+ Ellipse[] l = new Ellipse[ind];\r
+ for (int i = 0; i < ind; i++) { l[i] = new Ellipse(); }\r
+ return l;\r
+ }\r
+ public static Ellipse[,] Array(int indx, int indy)\r
+ {\r
+ Ellipse[,] l = new Ellipse[indx, indy];\r
+ for (int i = 0; i < indx; i++) { for (int j = 0; j < indy; j++) { l[i, j] = new Ellipse(); } }\r
+ return l;\r
+ }\r
+\r
public Ellipse()\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.null_line;\r
set(0,0);\r
}\r
public Ellipse(double wid, double hei)\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.null_line;\r
set(wid, hei);\r
}\r
\r
ydiameter = hei;\r
return this;\r
}\r
+ public Ellipse resize(double width, double height)\r
+ {\r
+ Point po = center;\r
+ set(width, height);\r
+ centering(po);\r
+ return this;\r
+ }\r
public Figure shift(Point p)\r
{\r
datum += p;\r
return this;\r
}\r
\r
- public void draw()\r
+ public virtual void draw()\r
{\r
Main.drawable.ellipse(this);\r
}\r
\r
public Polygon()\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.null_line;\r
vertices = new System.Collections.Generic.List<Point>();\r
}\r
public Polygon(double[] verts)\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.null_line;\r
vertices = new System.Collections.Generic.List<Point>();\r
for (int i=0; i < verts.Length; i+=2)\r
{\r
}\r
public Polygon(Point[] verts)\r
{\r
+ fill = Color.white;\r
+ stroke = Stroke.null_line;\r
vertices = new System.Collections.Generic.List<Point>();\r
foreach (Point p in verts)\r
{\r
return this;\r
}\r
\r
- public void draw()\r
+ public virtual void draw()\r
{\r
Main.drawable.polygon(this);\r
}\r