Documented more files

This commit is contained in:
Lukasz Baldyga committed 2020-11-02 19:50:12 +00:00
1 parent 2c186f1f1d
commit 8a73c1cd48
6 files changed
+105 -7

No files matched your search

@@ -5,20 +5,35 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs { namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
class Fill : Verb { /// <summary>
/// Fill Verb class
/// </summary>
public class Fill : Verb {
Drawer drawer; Drawer drawer;
bool enable; bool enable;
/// <summary>
/// Fill enables or disables the fill insider drawer
/// </summary>
/// <param name="drawer">drawer</param>
/// <param name="enable">Enable fill?</param>
public Fill(Drawer drawer, bool enable) { public Fill(Drawer drawer, bool enable) {
this.drawer = drawer; this.drawer = drawer;
this.enable = enable; this.enable = enable;
} }
/// <summary>
/// Sets the fill status
/// </summary>
public void ExecuteVerb() { public void ExecuteVerb() {
if (enable) drawer.EnableFill(); if (enable) drawer.EnableFill();
else drawer.DisableFill(); else drawer.DisableFill();
} }
/// <summary>
/// Describes what the command will do
/// </summary>
/// <returns>Description of what the verb will do</returns>
public string GetDescription() { public string GetDescription() {
if (enable) return "Enable fill"; if (enable) return "Enable fill";
else return "Disable fill"; else return "Disable fill";
@@ -6,25 +6,46 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs { namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
/// <summary>
/// MoveTo Verb class
/// </summary>
public class MoveTo : Verb { public class MoveTo : Verb {
protected Drawer drawer; Drawer drawer;
protected Point moveToPoint; Point moveToPoint;
/// <summary>
/// Creates a MoveTo instance
/// </summary>
/// <param name="drawer">drawer</param>
/// <param name="x">X position</param>
/// <param name="y">Y position</param>
public MoveTo(Drawer drawer, int x, int y) { public MoveTo(Drawer drawer, int x, int y) {
this.drawer = drawer; this.drawer = drawer;
this.moveToPoint = new Point(x, y); this.moveToPoint = new Point(x, y);
} }
/// <summary>
/// Creates a MoveTo instance
/// </summary>
/// <param name="drawer">drawer</param>
/// <param name="point">Point of the position</param>
public MoveTo(Drawer drawer, Point point) { public MoveTo(Drawer drawer, Point point) {
this.drawer = drawer; this.drawer = drawer;
this.moveToPoint = point; this.moveToPoint = point;
} }
/// <summary>
/// Moves the pen to the position
/// </summary>
public void ExecuteVerb() { public void ExecuteVerb() {
this.drawer.MovePen(moveToPoint); this.drawer.MovePen(moveToPoint);
} }
/// <summary>
/// Describes where the pen will move.
/// </summary>
/// <returns>Description where the pen will move to</returns>
public string GetDescription() { public string GetDescription() {
return "Move origin to " + moveToPoint.X + ", " + moveToPoint.Y; return "Move origin to " + moveToPoint.X + ", " + moveToPoint.Y;
} }
@@ -6,20 +6,35 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs { namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
class PenColor : Verb { /// <summary>
/// The PenColor Verb class
/// </summary>
public class PenColor : Verb {
Drawer drawer; Drawer drawer;
Color color; Color color;
/// <summary>
/// Creates a PenColor instance
/// </summary>
/// <param name="drawer">drawer</param>
/// <param name="color">Pen color</param>
public PenColor(Drawer drawer, Color color) { public PenColor(Drawer drawer, Color color) {
this.drawer = drawer; this.drawer = drawer;
this.color = color; this.color = color;
} }
/// <summary>
/// Sets the pen color
/// </summary>
public void ExecuteVerb() { public void ExecuteVerb() {
drawer.SetPenColor(color); drawer.SetPenColor(color);
} }
/// <summary>
/// Describes the pen color
/// </summary>
/// <returns>The description pen color</returns>
public string GetDescription() { public string GetDescription() {
return "Set pen color to: " + color.ToString(); return "Set pen color to: " + color.ToString();
} }
@@ -6,15 +6,33 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs { namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
class Quadrilateral : Verb { /// <summary>
/// The Quadrilateral Verb class
/// </summary>
public class Quadrilateral : Verb {
Verb verb; Verb verb;
/// <summary>
/// Creates a Quadrilateral instances
/// </summary>
/// <param name="drawer">drawer</param>
/// <param name="point1">first point</param>
/// <param name="point2">second point</param>
/// <param name="point3">third point</param>
/// <param name="point4">fourth point</param>
public Quadrilateral(Drawer drawer, Point point1, Point point2, Point point3, Point point4) { public Quadrilateral(Drawer drawer, Point point1, Point point2, Point point3, Point point4) {
verb = new DrawLines(drawer, new Point[] { point1, point2, point3, point4 }); verb = new DrawLines(drawer, new Point[] { point1, point2, point3, point4 });
} }
/// <summary>
/// Draws a quadrilateral from the points
/// </summary>
public void ExecuteVerb() => verb.ExecuteVerb(); public void ExecuteVerb() => verb.ExecuteVerb();
/// <summary>
/// Describes all of the points
/// </summary>
/// <returns>Description of the quadrilateral points</returns>
public string GetDescription() => verb.GetDescription(); public string GetDescription() => verb.GetDescription();
} }
} }
@@ -6,14 +6,26 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs { namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
//TODO: correct /// <summary>
class Rectangle : Verb { /// Rectangle Verb class
/// </summary>
/// <todo>
/// Correct
/// </todo>
public class Rectangle : Verb {
Verb verb; Verb verb;
Drawer drawer; Drawer drawer;
List<Point> points; List<Point> points;
bool correctForOrigin; bool correctForOrigin;
/// <summary>
/// Create a rectangle instance
/// </summary>
/// <param name="drawer">drawer</param>
/// <param name="width">rectangle width</param>
/// <param name="height">rectangle height</param>
/// <param name="center">weather to center the rectangle on the pen</param>
public Rectangle(Drawer drawer, double width, double height, bool center = true) { public Rectangle(Drawer drawer, double width, double height, bool center = true) {
this.drawer = drawer; this.drawer = drawer;
correctForOrigin = true; correctForOrigin = true;
@@ -30,6 +42,15 @@ namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
foreach (PointF pointF in points) this.points.Add(new Point((int)Math.Round(pointF.X), (int)Math.Round(pointF.Y))); foreach (PointF pointF in points) this.points.Add(new Point((int)Math.Round(pointF.X), (int)Math.Round(pointF.Y)));
} }
/// <summary>
/// Create a rectangle instance
/// </summary>
/// <remarks>
/// Unlike the above, this instance creates points based on widths and heights of the two points
/// </remarks>
/// <param name="drawer">drawer</param>
/// <param name="point1">point spawn</param>
/// <param name="point2">point spawn</param>
public Rectangle(Drawer drawer, Point point1, Point point2) { public Rectangle(Drawer drawer, Point point1, Point point2) {
this.drawer = drawer; this.drawer = drawer;
@@ -48,10 +69,17 @@ namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
} }
/// <summary>
/// Gets the description from the rectangle
/// </summary>
/// <returns>Describes the rectangle</returns>
public string GetDescription() { public string GetDescription() {
return ""; return "";
} }
/// <summary>
/// Draws the rectangle
/// </summary>
public void ExecuteVerb() => drawer.DrawLines(points.ToArray()); public void ExecuteVerb() => drawer.DrawLines(points.ToArray());
} }
@@ -16,6 +16,7 @@ namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
protected double offset; protected double offset;
List<Point> points; List<Point> points;
public RegularPolygon(Drawer drawer, int sides, double scale, double offset = 0, bool degMode = true) { public RegularPolygon(Drawer drawer, int sides, double scale, double offset = 0, bool degMode = true) {
points = new List<Point>(); points = new List<Point>();