Private
Public Access
Moved verbs into their own files
This commit is contained in:
1 parent
4bad451b83
commit
b5723ec5bc
12 files changed
+327
-240
No files matched your search
+10
@@ -66,6 +66,16 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Verbs\DrawingVerbs\Circle.cs" />
|
||||||
|
<Compile Include="Verbs\DrawingVerbs\DrawLines.cs" />
|
||||||
|
<Compile Include="Verbs\DrawingVerbs\DrawTo.cs" />
|
||||||
|
<Compile Include="Verbs\DrawingVerbs\MoveTo.cs" />
|
||||||
|
<Compile Include="Verbs\DrawingVerbs\Quadrilateral.cs" />
|
||||||
|
<Compile Include="Verbs\DrawingVerbs\Rectangle.cs" />
|
||||||
|
<Compile Include="Verbs\DrawingVerbs\RegularPolygon.cs" />
|
||||||
|
<Compile Include="Verbs\DrawingVerbs\Square.cs" />
|
||||||
|
<Compile Include="Verbs\DrawingVerbs\Triangle.cs" />
|
||||||
|
<Compile Include="Verbs\Verb.cs" />
|
||||||
<Compile Include="Windows\AboutWindow.cs">
|
<Compile Include="Windows\AboutWindow.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A class that generates a RegularPolygon verb.
|
|
||||||
/// </summary>
|
|
||||||
class RegularPolygon : Verb {
|
|
||||||
protected Drawer drawer;
|
|
||||||
protected int sides;
|
|
||||||
protected double scale;
|
|
||||||
protected double offset;
|
|
||||||
List<Point> points;
|
|
||||||
|
|
||||||
public RegularPolygon(Drawer drawer, int sides, double scale, double offset = 0, bool degMode = true) {
|
|
||||||
points = new List<Point>();
|
|
||||||
|
|
||||||
//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<Point> originShiftedPoints = new List<Point>();
|
|
||||||
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<Point> 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<Point>();
|
|
||||||
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<Point>();
|
|
||||||
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 {
|
abstract class Value {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+25
@@ -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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+36
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+26
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
+58
@@ -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<Point> 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<Point>();
|
||||||
|
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<Point>();
|
||||||
|
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());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+52
@@ -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 {
|
||||||
|
/// <summary>
|
||||||
|
/// A class that generates a RegularPolygon verb.
|
||||||
|
/// </summary>
|
||||||
|
public class RegularPolygon : Verb {
|
||||||
|
protected Drawer drawer;
|
||||||
|
protected int sides;
|
||||||
|
protected double scale;
|
||||||
|
protected double offset;
|
||||||
|
List<Point> points;
|
||||||
|
|
||||||
|
public RegularPolygon(Drawer drawer, int sides, double scale, double offset = 0, bool degMode = true) {
|
||||||
|
points = new List<Point>();
|
||||||
|
|
||||||
|
//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<Point> originShiftedPoints = new List<Point>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user