|
@@ -9,12 +9,38 @@ namespace SketchAssistant
|
|
|
{
|
|
|
class Line
|
|
|
{
|
|
|
- private Point Start { get; set; }
|
|
|
- private Point End { get; set; }
|
|
|
+ private List<Point> linePoints;
|
|
|
|
|
|
- public Line(int[] points)
|
|
|
+ public Line(List<Point> points)
|
|
|
{
|
|
|
+ linePoints = new List<Point>(points);
|
|
|
+ }
|
|
|
+
|
|
|
+ public Point GetStartPoint()
|
|
|
+ {
|
|
|
+ return linePoints.First();
|
|
|
+ }
|
|
|
|
|
|
+ public Point GetEndPoint()
|
|
|
+ {
|
|
|
+ return linePoints.Last();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public Graphics DrawLine(Graphics canvas)
|
|
|
+ {
|
|
|
+ Pen thePen = new Pen(Color.Black);
|
|
|
+ for(int i = 0; i < linePoints.Count; i++)
|
|
|
+ {
|
|
|
+ canvas.DrawLine(thePen, linePoints[i], linePoints[i + 1]);
|
|
|
+ }
|
|
|
+ canvas.DrawLine(thePen, linePoints[linePoints.Count-1], linePoints[linePoints.Count]);
|
|
|
+ return canvas;
|
|
|
}
|
|
|
}
|
|
|
}
|