diff --git a/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj b/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj
index 141200c..5a0b12b 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj
+++ b/Advanced Software Engineering/Advanced Software Engineering/Advanced Software Engineering.csproj
@@ -66,6 +66,16 @@
+
+
+
+
+
+
+
+
+
+
Form
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Command.cs b/Advanced Software Engineering/Advanced Software Engineering/Command.cs
index cce6a40..b95b281 100644
--- a/Advanced Software Engineering/Advanced Software Engineering/Command.cs
+++ b/Advanced Software Engineering/Advanced Software Engineering/Command.cs
@@ -140,246 +140,6 @@ namespace Advanced_Software_Engineering {
}
}
- public interface Verb {
- void ExecuteVerb();
- string GetDescription();
- }
-
- public class MoveTo : Verb {
-
- protected Drawer drawer;
- protected Point moveToPoint;
-
- public MoveTo(Drawer drawer, int x, int y) {
- this.drawer = drawer;
- this.moveToPoint = new Point(x, y);
- }
-
- public MoveTo(Drawer drawer, Point point) {
- this.drawer = drawer;
- this.moveToPoint = point;
- }
-
- public void ExecuteVerb() {
- this.drawer.MovePen(moveToPoint);
- }
-
- public string GetDescription() {
- return "Move origin to " + moveToPoint.X + ", " + moveToPoint.Y;
- }
-
- }
-
- public class DrawTo : Verb {
- protected Drawer drawer;
- protected Point moveToPoint;
-
- public DrawTo(Drawer drawer, int x, int y) {
- this.drawer = drawer;
- moveToPoint = new Point(x, y);
- }
-
- public void ExecuteVerb() {
- drawer.DrawLine(moveToPoint);
- }
-
- public string GetDescription() {
- return "Draw line " + moveToPoint.X + ", " + moveToPoint.Y;
- }
- }
-
- ///
- /// A class that generates a RegularPolygon verb.
- ///
- class RegularPolygon : Verb {
- protected Drawer drawer;
- protected int sides;
- protected double scale;
- protected double offset;
- List points;
-
- public RegularPolygon(Drawer drawer, int sides, double scale, double offset = 0, bool degMode = true) {
- points = new List();
-
- //if in degMode, convert the offset to radians
- if (degMode) offset = Math.PI * offset / 180;
-
- double constantAngleDelta = 2 * Math.PI / sides;
- for (int side = 0; side < sides; side++) {
- double angle = (constantAngleDelta * side) + offset;
-
- double dx = scale * Math.Sin(angle);
- double dy = scale * Math.Cos(angle);
-
- points.Add(new Point((int)Math.Round(dx), (int)Math.Round(dy)));
- }
-
- this.sides = sides;
- this.scale = scale;
- this.drawer = drawer;
- this.offset = offset;
- }
-
- public void ExecuteVerb() {
- Point currentOrigin = drawer.GetPenPosition();
- List originShiftedPoints = new List();
- foreach (Point point in points) originShiftedPoints.Add(new Point(point.X + currentOrigin.X, point.Y + currentOrigin.Y));
- drawer.DrawLines(originShiftedPoints.ToArray());
- }
-
- public string GetDescription() {
- return "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
- }
- }
-
- class Square : Verb {
-
- Verb verb;
-
- public Square(Drawer drawer, double scale) {
- verb = new RegularPolygon(drawer, 4, scale);
- }
-
- public Square(Drawer drawer, double scale, double offset) {
- verb = new RegularPolygon(drawer, 4, scale, offset);
- }
-
- public void ExecuteVerb() => verb.ExecuteVerb();
-
- public string GetDescription() => verb.GetDescription();
- }
-
- class Quadrilateral : Verb {
- Verb verb;
-
- bool descCreated = false;
- string desc;
-
- public Quadrilateral(Drawer drawer, Point point1, Point point2, Point point3, Point point4) {
- verb = new DrawLines(drawer, new Point[] { point1, point2, point3, point4 });
- }
-
- public void ExecuteVerb() => verb.ExecuteVerb();
-
- public string GetDescription() => verb.GetDescription();
- }
-
- class Triangle : Verb {
- Verb verb;
-
- public Triangle(Drawer drawer, double scale) {
- verb = new RegularPolygon(drawer, 3, scale);
- }
-
- public Triangle(Drawer drawer, double scale, double offset) {
- verb = new RegularPolygon(drawer, 3, scale, offset);
- }
-
- public Triangle(Drawer drawer, Point point1, Point point2, Point point3) {
- verb = new DrawLines(drawer, new Point[] { point1, point2, point3 });
- }
-
- public void ExecuteVerb() => verb.ExecuteVerb();
-
- public string GetDescription() => verb.GetDescription();
- }
-
- //TODO: correct
- class Rectangle : Verb {
- Verb verb;
-
- Drawer drawer;
- List points;
- bool correctForOrigin;
-
- public Rectangle(Drawer drawer, double width, double height, bool center = true) {
- this.drawer = drawer;
- correctForOrigin = true;
-
- PointF[] points = new PointF[]
- {
- new PointF((float) -width, (float) -height),
- new PointF((float) width, (float) -height),
- new PointF((float) width, (float) height),
- new PointF((float) -width, (float) height)
- };
-
- this.points = new List();
- foreach (PointF pointF in points) this.points.Add(new Point((int)Math.Round(pointF.X), (int)Math.Round(pointF.Y)));
- }
-
- public Rectangle(Drawer drawer, Point point1, Point point2) {
- this.drawer = drawer;
-
- PointF[] points = new PointF[]
- {
- new PointF((float) point1.X, (float) point1.Y),
- new PointF((float) point1.X, (float) point2.Y),
- new PointF((float) point2.X, (float) point2.Y),
- new PointF((float) point2.X, (float) point1.Y)
- };
-
- this.points = new List();
- foreach (PointF pointF in points) this.points.Add(new Point((int)Math.Round(pointF.X), (int)Math.Round(pointF.Y)));
-
- correctForOrigin = false;
-
- }
-
- public string GetDescription() {
- return "";
- }
-
- public void ExecuteVerb() => drawer.DrawLines(points.ToArray());
-
- }
-
- class Circle : Verb {
- Drawer drawer;
- double scale;
-
- public Circle(Drawer drawer, double scale) {
- this.drawer = drawer;
- this.scale = scale;
- }
-
- public void ExecuteVerb() {
- drawer.DrawCircle(scale);
- }
-
- public string GetDescription() {
- return "Draws a circle radius " + scale.ToString() + ", with origin of the pen";
- }
- }
-
- class DrawLines : Verb {
- Drawer drawer;
- Point[] points;
-
- bool descCreated = false;
- string desc;
-
- public DrawLines(Drawer drawer, Point[] points) {
- this.drawer = drawer;
- this.points = points;
- }
-
- public void ExecuteVerb() {
- drawer.DrawLines(points);
- }
-
- public string GetDescription() {
- if (!descCreated) {
- desc = "Draws a shape at points: ";
-
- foreach (Point point in points) {
- desc += point.X + ", " + point.Y + "\n";
- }
- }
- return desc;
- }
- }
-
abstract class Value {
}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Circle.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Circle.cs
new file mode 100644
index 0000000..fbac6ef
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Circle.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ class Circle : Verb {
+ Drawer drawer;
+ double scale;
+
+ public Circle(Drawer drawer, double scale) {
+ this.drawer = drawer;
+ this.scale = scale;
+ }
+
+ public void ExecuteVerb() {
+ drawer.DrawCircle(scale);
+ }
+
+ public string GetDescription() {
+ return "Draws a circle radius " + scale.ToString() + ", with origin of the pen";
+ }
+ }
+}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/DrawLines.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/DrawLines.cs
new file mode 100644
index 0000000..97d02cf
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/DrawLines.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ class DrawLines : Verb {
+ Drawer drawer;
+ Point[] points;
+
+ bool descCreated = false;
+ string desc;
+
+ public DrawLines(Drawer drawer, Point[] points) {
+ this.drawer = drawer;
+ this.points = points;
+ }
+
+ public void ExecuteVerb() {
+ drawer.DrawLines(points);
+ }
+
+ public string GetDescription() {
+ if (!descCreated) {
+ desc = "Draws a shape at points: ";
+
+ foreach (Point point in points) {
+ desc += point.X + ", " + point.Y + "\n";
+ }
+ }
+ return desc;
+ }
+ }
+}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/DrawTo.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/DrawTo.cs
new file mode 100644
index 0000000..d1fc659
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/DrawTo.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ public class DrawTo : Verb {
+ protected Drawer drawer;
+ protected Point moveToPoint;
+
+ public DrawTo(Drawer drawer, int x, int y) {
+ this.drawer = drawer;
+ moveToPoint = new Point(x, y);
+ }
+
+ public void ExecuteVerb() {
+ drawer.DrawLine(moveToPoint);
+ }
+
+ public string GetDescription() {
+ return "Draw line " + moveToPoint.X + ", " + moveToPoint.Y;
+ }
+ }
+}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/MoveTo.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/MoveTo.cs
new file mode 100644
index 0000000..f1483a3
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/MoveTo.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ public class MoveTo : Verb {
+
+ protected Drawer drawer;
+ protected Point moveToPoint;
+
+ public MoveTo(Drawer drawer, int x, int y) {
+ this.drawer = drawer;
+ this.moveToPoint = new Point(x, y);
+ }
+
+ public MoveTo(Drawer drawer, Point point) {
+ this.drawer = drawer;
+ this.moveToPoint = point;
+ }
+
+ public void ExecuteVerb() {
+ this.drawer.MovePen(moveToPoint);
+ }
+
+ public string GetDescription() {
+ return "Move origin to " + moveToPoint.X + ", " + moveToPoint.Y;
+ }
+
+ }
+}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Quadrilateral.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Quadrilateral.cs
new file mode 100644
index 0000000..00129e1
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Quadrilateral.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ class Quadrilateral : Verb {
+ Verb verb;
+
+ bool descCreated = false;
+ string desc;
+
+ public Quadrilateral(Drawer drawer, Point point1, Point point2, Point point3, Point point4) {
+ verb = new DrawLines(drawer, new Point[] { point1, point2, point3, point4 });
+ }
+
+ public void ExecuteVerb() => verb.ExecuteVerb();
+
+ public string GetDescription() => verb.GetDescription();
+ }
+}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Rectangle.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Rectangle.cs
new file mode 100644
index 0000000..2534839
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Rectangle.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ //TODO: correct
+ class Rectangle : Verb {
+ Verb verb;
+
+ Drawer drawer;
+ List points;
+ bool correctForOrigin;
+
+ public Rectangle(Drawer drawer, double width, double height, bool center = true) {
+ this.drawer = drawer;
+ correctForOrigin = true;
+
+ PointF[] points = new PointF[]
+ {
+ new PointF((float) -width, (float) -height),
+ new PointF((float) width, (float) -height),
+ new PointF((float) width, (float) height),
+ new PointF((float) -width, (float) height)
+ };
+
+ this.points = new List();
+ foreach (PointF pointF in points) this.points.Add(new Point((int)Math.Round(pointF.X), (int)Math.Round(pointF.Y)));
+ }
+
+ public Rectangle(Drawer drawer, Point point1, Point point2) {
+ this.drawer = drawer;
+
+ PointF[] points = new PointF[]
+ {
+ new PointF((float) point1.X, (float) point1.Y),
+ new PointF((float) point1.X, (float) point2.Y),
+ new PointF((float) point2.X, (float) point2.Y),
+ new PointF((float) point2.X, (float) point1.Y)
+ };
+
+ this.points = new List();
+ foreach (PointF pointF in points) this.points.Add(new Point((int)Math.Round(pointF.X), (int)Math.Round(pointF.Y)));
+
+ correctForOrigin = false;
+
+ }
+
+ public string GetDescription() {
+ return "";
+ }
+
+ public void ExecuteVerb() => drawer.DrawLines(points.ToArray());
+
+ }
+}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/RegularPolygon.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/RegularPolygon.cs
new file mode 100644
index 0000000..ceff3df
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/RegularPolygon.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ ///
+ /// A class that generates a RegularPolygon verb.
+ ///
+ public class RegularPolygon : Verb {
+ protected Drawer drawer;
+ protected int sides;
+ protected double scale;
+ protected double offset;
+ List points;
+
+ public RegularPolygon(Drawer drawer, int sides, double scale, double offset = 0, bool degMode = true) {
+ points = new List();
+
+ //if in degMode, convert the offset to radians
+ if (degMode) offset = Math.PI * offset / 180;
+
+ double constantAngleDelta = 2 * Math.PI / sides;
+ for (int side = 0; side < sides; side++) {
+ double angle = (constantAngleDelta * side) + offset;
+
+ double dx = scale * Math.Sin(angle);
+ double dy = scale * Math.Cos(angle);
+
+ points.Add(new Point((int)Math.Round(dx), (int)Math.Round(dy)));
+ }
+
+ this.sides = sides;
+ this.scale = scale;
+ this.drawer = drawer;
+ this.offset = offset;
+ }
+
+ public void ExecuteVerb() {
+ Point currentOrigin = drawer.GetPenPosition();
+ List originShiftedPoints = new List();
+ foreach (Point point in points) originShiftedPoints.Add(new Point(point.X + currentOrigin.X, point.Y + currentOrigin.Y));
+ drawer.DrawLines(originShiftedPoints.ToArray());
+ }
+
+ public string GetDescription() {
+ return "Draws a " + sides + " sided regular polygon, with rotation of " + offset + " radians, with inner radius of " + scale;
+ }
+ }
+}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Square.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Square.cs
new file mode 100644
index 0000000..d7cf1d0
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Square.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ class Square : Verb {
+
+ Verb verb;
+
+ public Square(Drawer drawer, double scale) {
+ verb = new RegularPolygon(drawer, 4, scale);
+ }
+
+ public Square(Drawer drawer, double scale, double offset) {
+ verb = new RegularPolygon(drawer, 4, scale, offset);
+ }
+
+ public void ExecuteVerb() => verb.ExecuteVerb();
+
+ public string GetDescription() => verb.GetDescription();
+ }
+}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Triangle.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Triangle.cs
new file mode 100644
index 0000000..49195e4
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/DrawingVerbs/Triangle.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ public class Triangle : Verb {
+ Verb verb;
+
+ public Triangle(Drawer drawer, double scale) {
+ verb = new RegularPolygon(drawer, 3, scale);
+ }
+
+ public Triangle(Drawer drawer, double scale, double offset) {
+ verb = new RegularPolygon(drawer, 3, scale, offset);
+ }
+
+ public Triangle(Drawer drawer, Point point1, Point point2, Point point3) {
+ verb = new DrawLines(drawer, new Point[] { point1, point2, point3 });
+ }
+
+ public void ExecuteVerb() => verb.ExecuteVerb();
+
+ public string GetDescription() => verb.GetDescription();
+ }
+}
diff --git a/Advanced Software Engineering/Advanced Software Engineering/Verbs/Verb.cs b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Verb.cs
new file mode 100644
index 0000000..dec20bc
--- /dev/null
+++ b/Advanced Software Engineering/Advanced Software Engineering/Verbs/Verb.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Advanced_Software_Engineering {
+ public interface Verb {
+ void ExecuteVerb();
+ string GetDescription();
+ }
+}