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;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
class Fill : Verb {
/// <summary>
/// Fill Verb class
/// </summary>
public class Fill : Verb {
Drawer drawer;
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) {
this.drawer = drawer;
this.enable = enable;
}
/// <summary>
/// Sets the fill status
/// </summary>
public void ExecuteVerb() {
if (enable) drawer.EnableFill();
else drawer.DisableFill();
}
/// <summary>
/// Describes what the command will do
/// </summary>
/// <returns>Description of what the verb will do</returns>
public string GetDescription() {
if (enable) return "Enable fill";
else return "Disable fill";
@@ -6,25 +6,46 @@ using System.Text;
using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
/// <summary>
/// MoveTo Verb class
/// </summary>
public class MoveTo : Verb {
protected Drawer drawer;
protected Point moveToPoint;
Drawer drawer;
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) {
this.drawer = drawer;
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) {
this.drawer = drawer;
this.moveToPoint = point;
}
/// <summary>
/// Moves the pen to the position
/// </summary>
public void ExecuteVerb() {
this.drawer.MovePen(moveToPoint);
}
/// <summary>
/// Describes where the pen will move.
/// </summary>
/// <returns>Description where the pen will move to</returns>
public string GetDescription() {
return "Move origin to " + moveToPoint.X + ", " + moveToPoint.Y;
}
@@ -6,20 +6,35 @@ using System.Text;
using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
class PenColor : Verb {
/// <summary>
/// The PenColor Verb class
/// </summary>
public class PenColor : Verb {
Drawer drawer;
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) {
this.drawer = drawer;
this.color = color;
}
/// <summary>
/// Sets the pen color
/// </summary>
public void ExecuteVerb() {
drawer.SetPenColor(color);
}
/// <summary>
/// Describes the pen color
/// </summary>
/// <returns>The description pen color</returns>
public string GetDescription() {
return "Set pen color to: " + color.ToString();
}
@@ -6,15 +6,33 @@ using System.Text;
using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
class Quadrilateral : Verb {
/// <summary>
/// The Quadrilateral Verb class
/// </summary>
public class Quadrilateral : 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) {
verb = new DrawLines(drawer, new Point[] { point1, point2, point3, point4 });
}
/// <summary>
/// Draws a quadrilateral from the points
/// </summary>
public void ExecuteVerb() => verb.ExecuteVerb();
/// <summary>
/// Describes all of the points
/// </summary>
/// <returns>Description of the quadrilateral points</returns>
public string GetDescription() => verb.GetDescription();
}
}
@@ -6,14 +6,26 @@ using System.Text;
using System.Threading.Tasks;
namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
//TODO: correct
class Rectangle : Verb {
/// <summary>
/// Rectangle Verb class
/// </summary>
/// <todo>
/// Correct
/// </todo>
public class Rectangle : Verb {
Verb verb;
Drawer drawer;
List<Point> points;
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) {
this.drawer = drawer;
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)));
}
/// <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) {
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() {
return "";
}
/// <summary>
/// Draws the rectangle
/// </summary>
public void ExecuteVerb() => drawer.DrawLines(points.ToArray());
}
@@ -16,6 +16,7 @@ namespace Advanced_Software_Engineering.Verbs.DrawingVerbs {
protected double offset;
List<Point> points;
public RegularPolygon(Drawer drawer, int sides, double scale, double offset = 0, bool degMode = true) {
points = new List<Point>();