Browse Source

Removed all build errors, runtime errors still remain

Martin Edlund 5 years ago
parent
commit
22b8dc33fc

+ 11 - 6
SketchAssistant/SketchAssistantWPF/GeometryCalculator.cs

@@ -98,32 +98,37 @@ namespace SketchAssistantWPF
         /// <returns>All points between p0 and p1 (including p0 and p1)</returns>
         public static List<Point> BresenhamLineAlgorithm(Point p0, Point p1)
         {
-            int deltaX = p1.X - p0.X;
-            int deltaY = p1.Y - p0.Y;
+            int p1x = (int)p1.X;
+            int p1y = (int)p1.Y;
+            int p0x = (int)p0.X;
+            int p0y = (int)p0.Y;
+
+            int deltaX = p1x - p0x;
+            int deltaY = p1y - p0y;
             List<Point> returnList;
 
             if (Math.Abs(deltaY) < Math.Abs(deltaX))
             {
                 if (p0.X > p1.X)
                 {
-                    returnList = GetLineLow(p1.X, p1.Y, p0.X, p0.Y);
+                    returnList = GetLineLow(p1x, p1y, p0x, p0y);
                     returnList.Reverse();
                 }
                 else
                 {
-                    returnList = GetLineLow(p0.X, p0.Y, p1.X, p1.Y);
+                    returnList = GetLineLow(p0x, p0y, p1x, p1y);
                 }
             }
             else
             {
                 if (p0.Y > p1.Y)
                 {
-                    returnList = GetLineHigh(p1.X, p1.Y, p0.X, p0.Y);
+                    returnList = GetLineHigh(p1x, p1y, p0x, p0y);
                     returnList.Reverse();
                 }
                 else
                 {
-                    returnList = GetLineHigh(p0.X, p0.Y, p1.X, p1.Y);
+                    returnList = GetLineHigh(p0x, p0y, p1x, p1y);
                 }
             }
             return returnList;

+ 27 - 0
SketchAssistant/SketchAssistantWPF/ImageDimension.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SketchAssistantWPF
+{
+    public class ImageDimension
+    {
+        public int Width { get; set; }
+
+        public int Height { get; set; }
+
+        public ImageDimension(int width, int height)
+        {
+            Width = width;
+            Height = height;
+        }
+
+        public void ChangeDimension(int width, int height)
+        {
+            Width = width;
+            Height = height;
+        }
+    }
+}

+ 2 - 2
SketchAssistant/SketchAssistantWPF/InternalLine.cs

@@ -78,7 +78,7 @@ namespace SketchAssistantWPF
         {
             return pointColl;
         }
-
+        /*
         /// <summary>
         /// A function that takes a Graphics element and returns it with
         /// the line drawn on it.
@@ -95,7 +95,7 @@ namespace SketchAssistantWPF
             if (linePoints.Count == 1) { canvas.FillRectangle(Brushes.Black, linePoints[0].X, linePoints[0].Y, 1, 1); }
             return canvas;
         }
-
+        */
         /// <summary>
         /// A function that will take to matrixes and populate the with the line data of this line object
         /// </summary>

+ 265 - 198
SketchAssistant/SketchAssistantWPF/MVP_Model.cs

@@ -90,6 +90,12 @@ namespace SketchAssistantWPF
         /// </summary>
         public int rightImageBoxHeight;
 
+        public ImageDimension leftImageSize { get; private set; }
+
+        public ImageDimension rightImageSize { get; private set; }
+
+        public bool canvasActive {get; set;}
+
         //Images
         Image leftImage;
 
@@ -110,113 +116,15 @@ namespace SketchAssistantWPF
             programPresenter = presenter;
             historyOfActions = new ActionHistory();
             //redrawAss = new RedrawAssistant();
+            //overlayItems = new List<Tuple<bool, HashSet<Point>>>();
             rightLineList = new List<Tuple<bool, InternalLine>>();
-            overlayItems = new List<Tuple<bool, HashSet<Point>>>();
+            canvasActive = false;
         }
 
         /**************************/
-        /*** INTERNAL FUNCTIONS ***/
+        /*** NEW INTERNAL FUNCTIONS ***/
         /**************************/
 
-        /// <summary>
-        /// A function that returns a white canvas for a given width and height.
-        /// </summary>
-        /// <param name="width">The width of the canvas in pixels</param>
-        /// <param name="height">The height of the canvas in pixels</param>
-        /// <returns>The new canvas</returns>
-        private Image GetEmptyCanvas(int width, int height)
-        {
-            Image image;
-            WriteableBitmap newCanvas;
-            try
-            {
-                newCanvas = new WriteableBitmap(width, height, 96, 96, PixelFormats.Bgra32, null);
-                image = new Bitmap(width, height);
-            }
-            catch (ArgumentException e)
-            {
-                programPresenter.PassMessageToView("The requested canvas size caused an error: \n"
-                    + e.ToString() + "\n The Canvas will be set to match your window.");
-                newCanvas = new WriteableBitmap(leftImageBoxWidth, leftImageBoxHeight, 96, 96, PixelFormats.Bgra32, null);
-            }
-            newCanvas.WritePixels()
-            Graphics graph = Graphics.FromImage(image);
-            graph.FillRectangle(Brushes.White, 0, 0, width + 10, height + 10);
-            return image;
-        }
-
-
-        /// <summary>
-        /// Creates an empty Canvas on the left
-        /// </summary>
-        /// <param name="width"> width of the new canvas in pixels </param>
-        /// <param name="height"> height of the new canvas in pixels </param>
-        private void DrawEmptyCanvasLeft(int width, int height)
-        {
-            if (width == 0)
-            {
-                leftImage = GetEmptyCanvas(leftImageBoxWidth, leftImageBoxHeight);
-            }
-            else
-            {
-                leftImage = GetEmptyCanvas(width, height);
-            }
-            programPresenter.UpdateLeftImage(leftImage);
-        }
-
-        /// <summary>
-        /// Redraws all lines in rightLineList, for which their associated boolean value equals true and calls RedrawRightOverlay.
-        /// </summary>
-        private void RedrawRightImage()
-        {
-            var workingCanvas = GetEmptyCanvas(rightImageWithoutOverlay.Width, rightImageWithoutOverlay.Height);
-            var workingGraph = Graphics.FromImage(workingCanvas);
-            //Lines
-            foreach (Tuple<bool, InternalLine> lineBoolTuple in rightLineList)
-            {
-                if (lineBoolTuple.Item1)
-                {
-                    lineBoolTuple.Item2.DrawLine(workingGraph);
-                }
-            }
-            //The Line being currently drawn
-            if (currentLine != null && currentLine.Count > 0 && inDrawingMode && mousePressed)
-            {
-                var currLine = new InternalLine(currentLine);
-                currLine.DrawLine(workingGraph);
-            }
-            rightImageWithoutOverlay = workingCanvas;
-            //Redraw the Overlay if needed
-            if (leftImage != null)
-            {
-                RedrawRightOverlay();
-            }
-            else
-            {
-                programPresenter.UpdateRightImage(rightImageWithoutOverlay);
-            }
-        }
-
-        /// <summary>
-        /// Redraws all elements in the overlay items for which the respective boolean value is true.
-        /// </summary>
-        private void RedrawRightOverlay()
-        {
-            var workingCanvas = rightImageWithoutOverlay;
-            var workingGraph = Graphics.FromImage(workingCanvas);
-            foreach (Tuple<bool, HashSet<Point>> tup in overlayItems)
-            {
-                if (tup.Item1)
-                {
-                    foreach (Point p in tup.Item2)
-                    {
-                        workingGraph.FillRectangle(Brushes.Green, p.X, p.Y, 1, 1);
-                    }
-                }
-            }
-            rightImageWithOverlay = workingCanvas;
-            programPresenter.UpdateRightImage(rightImageWithOverlay);
-        }
 
         /// <summary>
         /// Change the status of whether or not the lines are shown.
@@ -225,16 +133,13 @@ namespace SketchAssistantWPF
         /// <param name="shown">True if the lines should be shown, false if they should be hidden.</param>
         private void ChangeLines(HashSet<int> lines, bool shown)
         {
-            var changed = false;
             foreach (int lineId in lines)
             {
                 if (lineId <= rightLineList.Count - 1 && lineId >= 0)
                 {
                     rightLineList[lineId] = new Tuple<bool, InternalLine>(shown, rightLineList[lineId].Item2);
-                    changed = true;
                 }
             }
-            if (changed) { RedrawRightImage(); }
         }
 
         /// <summary>
@@ -244,8 +149,8 @@ namespace SketchAssistantWPF
         {
             if (rightImageWithoutOverlay != null)
             {
-                isFilledMatrix = new bool[(int) rightImageWithoutOverlay.Width, (int) rightImageWithoutOverlay.Height];
-                linesMatrix = new HashSet<int>[(int) rightImageWithoutOverlay.Width, (int) rightImageWithoutOverlay.Height];
+                isFilledMatrix = new bool[rightImageSize.Width, rightImageSize.Height];
+                linesMatrix = new HashSet<int>[rightImageSize.Width, rightImageSize.Height];
                 foreach (Tuple<bool, InternalLine> lineTuple in rightLineList)
                 {
                     if (lineTuple.Item1)
@@ -256,6 +161,14 @@ namespace SketchAssistantWPF
             }
         }
 
+        /// <summary>
+        /// Tells the Presenter to Update the UI
+        /// </summary>
+        private void UpdateUI()
+        {
+            programPresenter.UpdateUIState(inDrawingMode, historyOfActions.CanUndo(), historyOfActions.CanRedo(), canvasActive);
+        }
+
         /// <summary>
         /// A function that checks the deletion matrixes at a certain point 
         /// and returns all Line ids at that point and in a square around it in a certain range.
@@ -269,63 +182,28 @@ namespace SketchAssistantWPF
 
             foreach (Point pnt in GeometryCalculator.FilledCircleAlgorithm(p, (int)range))
             {
-                if (pnt.X >= 0 && pnt.Y >= 0 && pnt.X < rightImageWithoutOverlay.Width && pnt.Y < rightImageWithoutOverlay.Height)
+                if (pnt.X >= 0 && pnt.Y >= 0 && pnt.X < rightImageSize.Width && pnt.Y < rightImageSize.Height)
                 {
-                    if (isFilledMatrix[(int) pnt.X, (int) pnt.Y])
+                    if (isFilledMatrix[(int)pnt.X, (int)pnt.Y])
                     {
-                        returnSet.UnionWith(linesMatrix[(int) pnt.X, (int) pnt.Y]);
+                        returnSet.UnionWith(linesMatrix[(int)pnt.X, (int)pnt.Y]);
                     }
                 }
             }
             return returnSet;
         }
 
-        /*
-        /// <summary>
-        /// Will calculate the start and endpoints of the given line on the right canvas.
-        /// </summary>
-        /// <param name="line">The line.</param>
-        /// <param name="size">The size of the circle with which the endpoints of the line are marked.</param>
-        private Tuple<HashSet<Point>, HashSet<Point>> CalculateStartAndEnd(Line line, int size)
-        {
-            var circle0 = GeometryCalculator.FilledCircleAlgorithm(line.GetStartPoint(), size);
-            var circle1 = GeometryCalculator.FilledCircleAlgorithm(line.GetEndPoint(), size);
-            var currentLineEndings = new Tuple<HashSet<Point>, HashSet<Point>>(circle0, circle1);
-            return currentLineEndings;
-        }
-        */
-
-
-
-        /// <summary>
-        /// Tells the Presenter to Update the UI
-        /// </summary>
-        private void UpdateUI()
-        {
-            programPresenter.UpdateUIState(inDrawingMode, historyOfActions.CanUndo(), historyOfActions.CanRedo(), (rightImageWithoutOverlay != null));
-        }
-
-
         /********************************************/
-        /*** FUNCTIONS TO INTERACT WITH PRESENTER ***/
+        /*** NEW FUNCTIONS TO INTERACT WITH PRESENTER ***/
         /********************************************/
 
         /// <summary>
-        /// Creates an empty Canvas
+        /// A function to reset the right image.
         /// </summary>
-        public void DrawEmptyCanvasRight()
+        public void ResetRightImage()
         {
-            if (leftImage == null)
-            {
-                rightImageWithoutOverlay = GetEmptyCanvas(leftImageBoxWidth, leftImageBoxHeight);
-            }
-            else
-            {
-                rightImageWithoutOverlay = GetEmptyCanvas(leftImage.Width, leftImage.Height);
-            }
-            RepopulateDeletionMatrixes();
-            rightImageWithOverlay = rightImageWithoutOverlay;
-            programPresenter.UpdateRightImage(rightImageWithOverlay);
+            rightLineList = new List<Tuple<bool, InternalLine>>();
+            programPresenter.ClearRightLines();
         }
 
         /// <summary>
@@ -336,6 +214,11 @@ namespace SketchAssistantWPF
         /// <param name="listOfLines">The List of Lines to be displayed in the left image.</param>
         public void SetLeftLineList(int width, int height, List<InternalLine> listOfLines)
         {
+            leftImageSize = new ImageDimension(width, height);
+            rightImageSize = new ImageDimension(width, height);
+            leftLineList = listOfLines;
+            programPresenter.UpdateLeftLines(leftLineList);
+            /*
             var workingCanvas = GetEmptyCanvas(width, height);
             var workingGraph = Graphics.FromImage(workingCanvas);
             leftLineList = listOfLines;
@@ -351,6 +234,7 @@ namespace SketchAssistantWPF
             //Set right image to same size as left image and delete linelist
             DrawEmptyCanvasRight();
             rightLineList = new List<Tuple<bool, InternalLine>>();
+            */
         }
 
         /// <summary>
@@ -375,11 +259,8 @@ namespace SketchAssistantWPF
                     default:
                         break;
                 }
-                if (leftImage != null)
-                {
-                    //overlayItems = redrawAss.Tick(currentCursorPosition, rightLineList, -1, false);
-                }
-                RedrawRightImage();
+                //TODO: Add check if overlay needs to be added
+                programPresenter.UpdateRightLines(rightLineList);
             }
             RepopulateDeletionMatrixes();
             programPresenter.PassLastActionTaken(historyOfActions.MoveAction(true));
@@ -409,11 +290,8 @@ namespace SketchAssistantWPF
                     default:
                         break;
                 }
-                if (leftImage != null)
-                {
-                    //overlayItems = redrawAss.Tick(currentCursorPosition, rightLineList, -1, false);
-                }
-                RedrawRightImage();
+                //TODO: Add check if overlay needs to be added
+                programPresenter.UpdateRightLines(rightLineList);
                 RepopulateDeletionMatrixes();
             }
             UpdateUI();
@@ -428,23 +306,7 @@ namespace SketchAssistantWPF
             inDrawingMode = nowDrawing;
             UpdateUI();
         }
-
-        /// <summary>
-        /// A method to get the dimensions of the right image.
-        /// </summary>
-        /// <returns>A tuple containing the width and height of the right image.</returns>
-        public Tuple<int, int> GetRightImageDimensions()
-        {
-            if (rightImageWithoutOverlay != null)
-            {
-                return new Tuple<int, int>(rightImageWithoutOverlay.Width, rightImageWithoutOverlay.Height);
-            }
-            else
-            {
-                return new Tuple<int, int>(0, 0);
-            }
-        }
-
+        
         /// <summary>
         /// Updates the current cursor position of the model.
         /// </summary>
@@ -478,12 +340,8 @@ namespace SketchAssistantWPF
                 rightLineList.Add(new Tuple<bool, InternalLine>(true, newLine));
                 newLine.PopulateMatrixes(isFilledMatrix, linesMatrix);
                 programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Draw, newLine.GetID())));
-                if (leftImage != null)
-                {
-                    //Execute a RedrawAssistant tick with the currently finished Line
-                    //overlayItems = redrawAss.Tick(currentCursorPosition, rightLineList, newLine.GetID(), true);
-                }
-                RedrawRightImage();
+                //TODO: Add check if overlay needs to be added
+                programPresenter.UpdateRightLines(rightLineList);
             }
             UpdateUI();
         }
@@ -499,11 +357,8 @@ namespace SketchAssistantWPF
             //Drawing
             if (inDrawingMode && mousePressed)
             {
-                var rightGraph = Graphics.FromImage(rightImageWithoutOverlay);
                 currentLine.Add(currentCursorPosition);
-                InternalLine drawline = new InternalLine(currentLine);
-                drawline.DrawLine(rightGraph);
-                RedrawRightOverlay();
+                programPresenter.UpdateCurrentLine(currentLine);
             }
             //Deleting
             if (!inDrawingMode && mousePressed)
@@ -520,12 +375,8 @@ namespace SketchAssistantWPF
                             rightLineList[lineID] = new Tuple<bool, InternalLine>(false, rightLineList[lineID].Item2);
                         }
                         RepopulateDeletionMatrixes();
-                        if (leftImage != null)
-                        {
-                            //Redraw overlay gets ticked
-                            //overlayItems = redrawAss.Tick(currentCursorPosition, rightLineList, -1, false);
-                        }
-                        RedrawRightImage();
+                        //TODO: Add check if overlay needs to be added
+                        programPresenter.UpdateRightLines(rightLineList);
                     }
                 }
             }
@@ -534,14 +385,15 @@ namespace SketchAssistantWPF
         /// <summary>
         /// A helper Function that updates the markerRadius & deletionRadius, considering the size of the canvas.
         /// </summary>
-        public void UpdateSizes()
+        /// <param name="CanvasSize">The size of the canvas</param>
+        public void UpdateSizes(ImageDimension CanvasSize)
         {
             if (rightImageWithoutOverlay != null)
             {
-                int widthImage = rightImageWithoutOverlay.Width;
-                int heightImage = rightImageWithoutOverlay.Height;
-                int widthBox = rightImageBoxWidth;
-                int heightBox = rightImageBoxHeight;
+                int widthImage = rightImageSize.Width;
+                int heightImage = rightImageSize.Height;
+                int widthBox = CanvasSize.Width;
+                int heightBox = CanvasSize.Height;
 
                 float imageRatio = (float)widthImage / (float)heightImage;
                 float containerRatio = (float)widthBox / (float)heightBox;
@@ -557,7 +409,6 @@ namespace SketchAssistantWPF
                     zoomFactor = (float)heightImage / (float)heightBox;
                 }
                 markerRadius = (int)(10 * zoomFactor);
-                redrawAss.SetMarkerRadius(markerRadius);
                 deletionRadius = (int)(5 * zoomFactor);
             }
         }
@@ -570,5 +421,221 @@ namespace SketchAssistantWPF
         {
             return !historyOfActions.IsEmpty();
         }
+
+        /**************************/
+        /*** INTERNAL FUNCTIONS ***/
+        /**************************/
+
+        /*
+    /// <summary>
+    /// A function that returns a white canvas for a given width and height.
+    /// </summary>
+    /// <param name="width">The width of the canvas in pixels</param>
+    /// <param name="height">The height of the canvas in pixels</param>
+    /// <returns>The new canvas</returns>
+    private Image GetEmptyCanvas(int width, int height)
+    {
+        Image image;
+        WriteableBitmap newCanvas;
+        try
+        {
+            newCanvas = new WriteableBitmap(width, height, 96, 96, PixelFormats.Bgra32, null);
+            image = new Bitmap(width, height);
+        }
+        catch (ArgumentException e)
+        {
+            programPresenter.PassMessageToView("The requested canvas size caused an error: \n"
+                + e.ToString() + "\n The Canvas will be set to match your window.");
+            newCanvas = new WriteableBitmap(leftImageBoxWidth, leftImageBoxHeight, 96, 96, PixelFormats.Bgra32, null);
+        }
+        newCanvas.WritePixels()
+        Graphics graph = Graphics.FromImage(image);
+        graph.FillRectangle(Brushes.White, 0, 0, width + 10, height + 10);
+        return image;
+    }
+
+
+    /// <summary>
+    /// Creates an empty Canvas on the left
+    /// </summary>
+    /// <param name="width"> width of the new canvas in pixels </param>
+    /// <param name="height"> height of the new canvas in pixels </param>
+    private void DrawEmptyCanvasLeft(int width, int height)
+    {
+        if (width == 0)
+        {
+            leftImage = GetEmptyCanvas(leftImageBoxWidth, leftImageBoxHeight);
+        }
+        else
+        {
+            leftImage = GetEmptyCanvas(width, height);
+        }
+        programPresenter.UpdateLeftImage(leftImage);
+    }
+
+    /// <summary>
+    /// Redraws all lines in rightLineList, for which their associated boolean value equals true and calls RedrawRightOverlay.
+    /// </summary>
+    private void RedrawRightImage()
+    {
+        var workingCanvas = GetEmptyCanvas(rightImageWithoutOverlay.Width, rightImageWithoutOverlay.Height);
+        var workingGraph = Graphics.FromImage(workingCanvas);
+        //Lines
+        foreach (Tuple<bool, InternalLine> lineBoolTuple in rightLineList)
+        {
+            if (lineBoolTuple.Item1)
+            {
+                lineBoolTuple.Item2.DrawLine(workingGraph);
+            }
+        }
+        //The Line being currently drawn
+        if (currentLine != null && currentLine.Count > 0 && inDrawingMode && mousePressed)
+        {
+            var currLine = new InternalLine(currentLine);
+            currLine.DrawLine(workingGraph);
+        }
+        rightImageWithoutOverlay = workingCanvas;
+        //Redraw the Overlay if needed
+        if (leftImage != null)
+        {
+            RedrawRightOverlay();
+        }
+        else
+        {
+            programPresenter.UpdateRightImage(rightImageWithoutOverlay);
+        }
+    }
+
+        /// <summary>
+        /// Redraws all elements in the overlay items for which the respective boolean value is true.
+        /// </summary>
+        private void RedrawRightOverlay()
+        {
+            var workingCanvas = rightImageWithoutOverlay;
+            var workingGraph = Graphics.FromImage(workingCanvas);
+            foreach (Tuple<bool, HashSet<Point>> tup in overlayItems)
+            {
+                if (tup.Item1)
+                {
+                    foreach (Point p in tup.Item2)
+                    {
+                        workingGraph.FillRectangle(Brushes.Green, p.X, p.Y, 1, 1);
+                    }
+                }
+            }
+            rightImageWithOverlay = workingCanvas;
+            programPresenter.UpdateRightImage(rightImageWithOverlay);
+        }
+    */
+
+
+
+
+        /*
+        /// <summary>
+        /// Will calculate the start and endpoints of the given line on the right canvas.
+        /// </summary>
+        /// <param name="line">The line.</param>
+        /// <param name="size">The size of the circle with which the endpoints of the line are marked.</param>
+        private Tuple<HashSet<Point>, HashSet<Point>> CalculateStartAndEnd(Line line, int size)
+        {
+            var circle0 = GeometryCalculator.FilledCircleAlgorithm(line.GetStartPoint(), size);
+            var circle1 = GeometryCalculator.FilledCircleAlgorithm(line.GetEndPoint(), size);
+            var currentLineEndings = new Tuple<HashSet<Point>, HashSet<Point>>(circle0, circle1);
+            return currentLineEndings;
+        }
+        */
+
+
+
+
+
+
+        /********************************************/
+        /*** FUNCTIONS TO INTERACT WITH PRESENTER ***/
+        /********************************************/
+        /*
+        /// <summary>
+        /// Creates an empty Canvas
+        /// </summary>
+        public void DrawEmptyCanvasRight()
+        {
+            if (leftImage == null)
+            {
+                rightImageWithoutOverlay = GetEmptyCanvas(leftImageBoxWidth, leftImageBoxHeight);
+            }
+            else
+            {
+                rightImageWithoutOverlay = GetEmptyCanvas(leftImage.Width, leftImage.Height);
+            }
+            RepopulateDeletionMatrixes();
+            rightImageWithOverlay = rightImageWithoutOverlay;
+            programPresenter.UpdateRightImage(rightImageWithOverlay);
+        }
+
+
+        /// <summary>
+        /// A method to get the dimensions of the right image.
+        /// </summary>
+        /// <returns>A tuple containing the width and height of the right image.</returns>
+        public Tuple<int, int> GetRightImageDimensions()
+        {
+            if (rightImageWithoutOverlay != null)
+            {
+                return new Tuple<int, int>(rightImageWithoutOverlay.Width, rightImageWithoutOverlay.Height);
+            }
+            else
+            {
+                return new Tuple<int, int>(0, 0);
+            }
+        }
+
+
+        /// <summary>
+        /// Method to be called every tick. Updates the current Line, or checks for Lines to delete, depending on the drawing mode.
+        /// </summary>
+        public void Tick()
+        {
+            if (cursorPositions.Count > 0) { previousCursorPosition = cursorPositions.Dequeue(); }
+            else { previousCursorPosition = currentCursorPosition; }
+            cursorPositions.Enqueue(currentCursorPosition);
+            //Drawing
+            if (inDrawingMode && mousePressed)
+            {
+                var rightGraph = Graphics.FromImage(rightImageWithoutOverlay);
+                currentLine.Add(currentCursorPosition);
+                InternalLine drawline = new InternalLine(currentLine);
+                drawline.DrawLine(rightGraph);
+                RedrawRightOverlay();
+            }
+            //Deleting
+            if (!inDrawingMode && mousePressed)
+            {
+                List<Point> uncheckedPoints = GeometryCalculator.BresenhamLineAlgorithm(previousCursorPosition, currentCursorPosition);
+                foreach (Point currPoint in uncheckedPoints)
+                {
+                    HashSet<int> linesToDelete = CheckDeletionMatrixesAroundPoint(currPoint, deletionRadius);
+                    if (linesToDelete.Count > 0)
+                    {
+                        programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Delete, linesToDelete)));
+                        foreach (int lineID in linesToDelete)
+                        {
+                            rightLineList[lineID] = new Tuple<bool, InternalLine>(false, rightLineList[lineID].Item2);
+                        }
+                        RepopulateDeletionMatrixes();
+                        if (leftImage != null)
+                        {
+                            //Redraw overlay gets ticked
+                            //overlayItems = redrawAss.Tick(currentCursorPosition, rightLineList, -1, false);
+                        }
+                        RedrawRightImage();
+                    }
+                }
+            }
+        }
+
+    */
+
+
     }
 }

+ 124 - 23
SketchAssistant/SketchAssistantWPF/MVP_Presenter.cs

@@ -6,6 +6,8 @@ using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Shapes;
 
 namespace SketchAssistantWPF
 {
@@ -19,6 +21,22 @@ namespace SketchAssistantWPF
         /// The Model of the MVP-Model.
         /// </summary>
         MVP_Model programModel;
+        /// <summary>
+        /// A dictionary connecting the id of an InternalLine with the respective Polyline in the right canvas.
+        /// </summary>
+        Dictionary<int, Polyline> rightPolyLines;
+        /// <summary>
+        /// A dictionary connecting the id of an InternalLine with the respective Polyline in the left canvas.
+        /// </summary>
+        Dictionary<int, Polyline> leftPolyLines;
+
+        ImageDimension CanvasSizeLeft = new ImageDimension(0,0);
+
+        ImageDimension CanvasSizeRight = new ImageDimension(0, 0);
+
+        ImageDimension ImageSizeLeft = new ImageDimension(0, 0);
+
+        ImageDimension ImageSizeRight = new ImageDimension(0, 0);
 
         /*******************/
         /*** ENUMERATORS ***/
@@ -61,11 +79,15 @@ namespace SketchAssistantWPF
         /// <param name="rightPBS">The new size of the left picture box.</param>
         public void Resize(Tuple<int, int> leftPBS, Tuple<int, int> rightPBS)
         {
+            CanvasSizeLeft.ChangeDimension(leftPBS.Item1, leftPBS.Item2);
+            CanvasSizeRight.ChangeDimension(rightPBS.Item1, rightPBS.Item2);
+            /*
             programModel.leftImageBoxWidth = leftPBS.Item1;
             programModel.leftImageBoxHeight = leftPBS.Item2;
             programModel.rightImageBoxWidth = rightPBS.Item1;
             programModel.rightImageBoxHeight = rightPBS.Item2;
-            programModel.UpdateSizes();
+            */
+            programModel.UpdateSizes(CanvasSizeRight);
         }
 
         /// <summary>
@@ -84,7 +106,7 @@ namespace SketchAssistantWPF
                 if (!fileNameTup.Item1.Equals("") && !fileNameTup.Item2.Equals(""))
                 {
                     programView.SetToolStripLoadStatus(fileNameTup.Item2);
-                    Tuple<int, int, List<Line>> values = fileImporter.ParseISADInputFile(fileNameTup.Item1);
+                    Tuple<int, int, List<InternalLine>> values = fileImporter.ParseISADInputFile(fileNameTup.Item1);
                     programModel.SetLeftLineList(values.Item1, values.Item2, values.Item3);
                     programModel.ChangeState(true);
                     programView.EnableTimer();
@@ -117,6 +139,14 @@ namespace SketchAssistantWPF
             programModel.Redo();
         }
 
+        /// <summary>
+        /// Pass-trough function for ticking the model.
+        /// </summary>
+        public void Tick()
+        {
+            programModel.Tick();
+        }
+
         /// <summary>
         /// Checks if there is unsaved progress, and promts the model to generate a new canvas if not.
         /// </summary>
@@ -129,31 +159,23 @@ namespace SketchAssistantWPF
             }
             if (okToContinue)
             {
-                programModel.DrawEmptyCanvasRight();
+                programModel.canvasActive = true;
                 programModel.ChangeState(true);
                 programView.EnableTimer();
             }
         }
 
-        /// <summary>
-        /// Pass-trough function for ticking the model.
-        /// </summary>
-        public void Tick()
-        {
-            programModel.Tick();
-        }
-
         /// <summary>
         /// Pass-trough when the mouse is moved.
         /// </summary>
         /// <param name="mouseAction">The action which is sent by the View.</param>
         /// <param name="e">The Mouse event arguments.</param>
-        public void MouseEvent(MouseAction mouseAction, MouseEventArgs e)
+        public void MouseEvent(MouseAction mouseAction, Point position)
         {
             switch (mouseAction)
             {
                 case MouseAction.Move:
-                    programModel.SetCurrentCursorPosition(ConvertCoordinates(e.GetPosition());
+                    programModel.SetCurrentCursorPosition(ConvertCoordinates(position));
                     break;
                 default:
                     break;
@@ -189,6 +211,65 @@ namespace SketchAssistantWPF
         /*** FUNCTIONS MODEL -> PRESENTER ***/
         /************************************/
 
+        /// <summary>
+        /// Updates the currentline
+        /// </summary>
+        /// <param name="linepoints">The points of the current line.</param>
+        public void UpdateCurrentLine(List<Point> linepoints)
+        {
+            Polyline currentLine = new Polyline();
+            currentLine.Stroke = Brushes.Black;
+            currentLine.Points = new PointCollection(linepoints);
+            programView.DisplayCurrLine(currentLine);
+        }
+
+        /// <summary>
+        /// Clears all Lines in the right canvas.
+        /// </summary>
+        public void ClearRightLines()
+        {
+            programView.RemoveAllRightLines();
+            rightPolyLines = new Dictionary<int, Polyline>();
+        }
+
+        /// <summary>
+        /// A function to update the displayed lines in the right canvas.
+        /// </summary>
+        public void UpdateRightLines(List<Tuple<bool, InternalLine>> lines)
+        {
+            foreach(Tuple<bool, InternalLine> tup in lines)
+            {
+                var status = tup.Item1;
+                var line = tup.Item2;
+                if (!rightPolyLines.ContainsKey(line.GetID()))
+                {
+                    Polyline newLine = new Polyline();
+                    newLine.Stroke = Brushes.Black;
+                    newLine.Points = line.GetPointCollection();
+                    rightPolyLines.Add(line.GetID(), newLine);
+                    programView.AddNewLineRight(newLine);
+                }
+                SetVisibility(rightPolyLines[line.GetID()], status);
+            }
+        }
+
+        /// <summary>
+        /// A function to update the displayed lines in the left canvas.
+        /// </summary>
+        public void UpdateLeftLines(List<InternalLine> lines)
+        {
+            programView.RemoveAllLeftLines();
+            leftPolyLines = new Dictionary<int, Polyline>();
+            foreach(InternalLine line in lines)
+            {
+                Polyline newLine = new Polyline();
+                newLine.Stroke = Brushes.Black;
+                newLine.Points = line.GetPointCollection();
+                leftPolyLines.Add(line.GetID(), newLine);
+                programView.AddNewLineLeft(newLine);
+            }
+        }
+
         /// <summary>
         /// Called by the model when the state of the Program changes. 
         /// Changes the look of the UI according to the current state of the model.
@@ -224,23 +305,25 @@ namespace SketchAssistantWPF
             }
         }
 
+
+        /*
         /// <summary>
         /// Is called by the model when the left image is changed.
         /// </summary>
-        /// <param name="img">The new image.</param>
-        public void UpdateLeftImage(Image img)
+        /// <param name="lineList">The new image.</param>
+        public void UpdateLeftImage(List<InternalLine> lineList)
         {
-            programView.DisplayInLeftPictureBox(img);
+            programView.DisplayInLeftPictureBox(lineList);
         }
 
         /// <summary>
         /// Is called by the model when the right image is changed.
         /// </summary>
-        /// <param name="img">The new image.</param>
-        public void UpdateRightImage(Image img)
+        /// <param name="lineList">The new image.</param>
+        public void UpdateRightImage(List<InternalLine> lineList)
         {
-            programView.DisplayInRightPictureBox(img);
-        }
+            programView.DisplayInRightPictureBox(lineList);
+        }*/
 
         /// <summary>
         /// Pass-trough function to display an info message in the view.
@@ -264,6 +347,23 @@ namespace SketchAssistantWPF
         /*** HELPING FUNCTIONS ***/
         /*************************/
 
+        /// <summary>
+        /// Sets the visibility of a polyline.
+        /// </summary>
+        /// <param name="line">The polyline</param>
+        /// <param name="visible">Whether or not it should be visible.</param>
+        private void SetVisibility(Polyline line, bool visible)
+        {
+            if (visible)
+            {
+                line.Opacity = 0.00001;
+            }
+            else
+            {
+                line.Opacity = 1;
+            }
+        }
+
         /// <summary>
         /// A function that calculates the coordinates of a point on a zoomed in image.
         /// </summary>
@@ -271,11 +371,12 @@ namespace SketchAssistantWPF
         /// <returns>The real coordinates of the mouse cursor on the image</returns>
         private Point ConvertCoordinates(Point cursorPosition)
         {
-            var rightImageDimensions = programModel.GetRightImageDimensions();
+            if (!programModel.canvasActive) { return cursorPosition; }
+            ImageDimension rightImageDimensions = programModel.rightImageSize;
             Point realCoordinates = new Point(0, 0);
 
-            int widthImage = rightImageDimensions.Item1;
-            int heightImage = rightImageDimensions.Item2;
+            int widthImage = rightImageDimensions.Width;
+            int heightImage = rightImageDimensions.Height;
             int widthBox = programModel.rightImageBoxWidth;
             int heightBox = programModel.rightImageBoxHeight;
 

+ 34 - 12
SketchAssistant/SketchAssistantWPF/MVP_View.cs

@@ -4,12 +4,46 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Controls;
+using System.Windows.Shapes;
 
 namespace SketchAssistantWPF
 {
     public interface MVP_View
     {
 
+        /// <summary>
+        /// Remove the current line.
+        /// </summary>
+        void RemoveCurrLine();
+
+        /// <summary>
+        /// Display the current line.
+        /// </summary>
+        /// <param name="line">The current line to display</param>
+        void DisplayCurrLine(Polyline line);
+
+        /// <summary>
+        /// Removes all Lines from the left canvas.
+        /// </summary>
+        void RemoveAllLeftLines();
+
+        /// <summary>
+        /// Removes all lines in the right canvas.
+        /// </summary>
+        void RemoveAllRightLines();
+
+        /// <summary>
+        /// Adds another Line that will be displayed in the left display.
+        /// </summary>
+        /// <param name="newLine">The new Polyline to be added displayed.</param>
+        void AddNewLineLeft(Polyline newLine);
+
+        /// <summary>
+        /// Adds another Line that will be displayed in the right display.
+        /// </summary>
+        /// <param name="newLine">The new Polyline to be added displayed.</param>
+        void AddNewLineRight(Polyline newLine);
+
         /// <summary>
         /// Enables the timer of the View, which will tick the Presenter.
         /// </summary>
@@ -42,18 +76,6 @@ namespace SketchAssistantWPF
         /// <param name="state">The new state of the button.</param>
         void SetToolStripButtonStatus(String buttonName, MainWindow.ButtonState state);
 
-        /// <summary>
-        /// Displays a list of lines in the left Picture box.
-        /// </summary>
-        /// <param name="img">The new image.</param>
-        void DisplayInLeftPictureBox(List<Line> lineList);
-
-        /// <summary>
-        /// Displays a list of lines in the right Picture box.
-        /// </summary>
-        /// <param name="img">The new image.</param>
-        void DisplayInRightPictureBox(List<Line> lineList);
-
         /// <summary>
         /// shows the given info message in a popup and asks the user to aknowledge it
         /// </summary>

+ 36 - 5
SketchAssistant/SketchAssistantWPF/MainWindow.xaml

@@ -34,7 +34,7 @@
                 </MenuItem>
             </Menu>
         </ToolBar>
-
+        <!-- All Icons in the Toolbar taken from openclipart.org -->
         <ToolBar x:Name="DrawingToolBar" Grid.Column="4" Grid.Row="0" Grid.ColumnSpan="2">
             <Button x:Name="CanvasButton" ToolTip="Create a new Canvas" Click="CanvasButton_Click">
                 <Rectangle Width="30" Height="30">
@@ -70,8 +70,10 @@
                     <Rectangle.Fill>
                         <DrawingBrush>
                             <DrawingBrush.Drawing>
-                                <DrawingGroup>
-                                    <GeometryDrawing Brush="#FF000000" Geometry="F1 M485.219,485.22z M0,0z M467.476,146.438L446.031,167.893 317.35,39.23 338.795,17.773C362.484,-5.919,400.899,-5.919,424.59,17.773L467.476,60.67C491.133,84.349,491.133,122.748,467.476,146.438z M167.233,403.748C161.311,409.67 161.311,419.261 167.233,425.184 173.158,431.139 182.754,431.139 188.676,425.184L424.59,189.335 403.121,167.878 167.233,403.748z M60,296.54C54.075,302.467 54.075,312.054 60,317.98 65.922,323.903 75.518,323.903 81.443,317.98L317.35,82.113 295.914,60.67 60,296.54z M338.767,103.54L102.881,339.421C91.036,351.243 91.066,370.462 102.881,382.307 114.731,394.153 133.919,394.208 145.795,382.275L381.681,146.438 338.767,103.54z M145.734,446.572C138.481,439.31 134.985,430.107 133.684,420.624 130.601,421.1 127.496,421.543 124.324,421.543 108.122,421.543 92.905,415.21 81.443,403.748 69.981,392.257 63.673,377.061 63.673,360.861 63.673,357.907 64.116,355.028 64.532,352.158 54.729,350.823 45.668,346.529 38.56,339.421 37.878,338.744 37.643,337.825 37.022,337.083L0,485.216 147.748,448.23C147.097,447.637,146.36,447.193,145.734,446.572z" />
+                                <DrawingGroup ClipGeometry="M0,0 V100 H100 V0 H0 Z">
+                                    <GeometryDrawing Brush="#FF000000" Geometry="F1 M100,100z M0,0z M69.172,11.265C68.981,11.073,68.67,11.073,68.477,11.265L11.639,68.029C11.447,68.22,11.447,68.53,11.639,68.721L30.846,87.905C30.942,88 31.068,88.048 31.194,88.048 31.319,88.048 31.445,88 31.541,87.905L88.38,31.14C88.473,31.048 88.525,30.924 88.525,30.793 88.525,30.662 88.473,30.538 88.38,30.446L69.172,11.265z" />
+                                    <GeometryDrawing Brush="#FF000000" Geometry="F1 M100,100z M0,0z M96.846,9.12L90.527,2.809C88.713,0.997999999999999 86.301,-8.88178419700125E-16 83.735,-8.88178419700125E-16 81.171,-8.88178419700125E-16 78.758,0.997999999999999 76.945,2.809L70.626,9.12C70.533,9.212 70.481,9.336 70.481,9.467 70.481,9.597 70.533,9.721 70.626,9.813L89.833,28.995C89.925,29.087 90.051,29.139 90.181,29.139 90.312,29.139 90.436,29.087 90.527,28.995L96.846,22.684C98.66,20.872 99.659,18.464 99.659,15.901 99.659,13.34 98.66,10.932 96.846,9.12z" />
+                                    <GeometryDrawing Brush="#FF000000" Geometry="F1 M100,100z M0,0z M10.358,69.967C10.236,69.846 10.062,69.795 9.894,69.838 9.727,69.878 9.594,70.003 9.543,70.168L0.363,99.363C0.308,99.541 0.357,99.732 0.49,99.861 0.584,99.952 0.707,100 0.832,100 0.886,100 0.942,99.989 0.996,99.971L29.383,89.959C29.542,89.903 29.661,89.771 29.698,89.605 29.735,89.441 29.686,89.268 29.566,89.15L10.358,69.967z" />
                                 </DrawingGroup>
                             </DrawingBrush.Drawing>
                         </DrawingBrush>
@@ -83,8 +85,37 @@
                     <Rectangle.Fill>
                         <DrawingBrush>
                             <DrawingBrush.Drawing>
-                                <DrawingGroup ClipGeometry="M0,0 V512 H512 V0 H0 Z">
-                                    <GeometryDrawing Brush="#FF000000" Geometry="F1 M512,512z M0,0z M497.941,273.941C516.686,255.196,516.686,224.804,497.941,206.059L337.941,46.059C319.196,27.314,288.805,27.313,270.058,46.059L14.058,302.059C-4.68700000000001,320.804,-4.68700000000001,351.196,14.058,369.941L110.058,465.941A48.004,48.004,0,0,0,144,480L500,480C506.627,480,512,474.627,512,468L512,428C512,421.373,506.627,416,500,416L355.883,416 497.941,273.941z M195.314,211.314L332.687,348.687 265.373,416 150.628,416 70.628,336 195.314,211.314z" />
+                                <DrawingGroup ClipGeometry="M0,0 V60 H60 V0 H0 Z">
+                                    <DrawingGroup>
+                                        <GeometryDrawing Geometry="F1 M60,60z M0,0z M41.312,11.031L6.438,32.5C5.407,33.151,4.6875,34.249,4.6875,35.562L4.6875,45.281C4.6875,47.32,6.3367,48.969,8.375,48.969L24.656,48.969C25.444,48.969,26.121,48.669,26.719,48.25L54.312,26.719 55.312,11.094 41.312,11.031z">
+                                            <GeometryDrawing.Pen>
+                                                <Pen Brush="#FFFFFFFF" Thickness="8.125" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
+                                            </GeometryDrawing.Pen>
+                                        </GeometryDrawing>
+                                        <DrawingGroup Transform="0.99664,0,0,0.99664,-0.3563,-0.39594">
+                                            <GeometryDrawing Brush="#FF000000" Geometry="F0 M60,60z M0,0z M27.173,48.89L54.852,27.221 55.857,11.533 27.522,33.19 27.173,48.89z">
+                                                <GeometryDrawing.Pen>
+                                                    <Pen Brush="#FF000000" Thickness="3.1356" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
+                                                </GeometryDrawing.Pen>
+                                            </GeometryDrawing>
+                                            <GeometryDrawing Brush="#FFFFFFFF" Geometry="F0 M60,60z M0,0z M6.6373,32.995L41.8073,11.464 55.8573,11.533 27.5223,33.19 6.63729999999999,32.995z">
+                                                <GeometryDrawing.Pen>
+                                                    <Pen Brush="#FF000000" Thickness="3.1356" StartLineCap="Round" EndLineCap="Round" LineJoin="Round" />
+                                                </GeometryDrawing.Pen>
+                                            </GeometryDrawing>
+                                            <GeometryDrawing>
+                                                <GeometryDrawing.Brush>
+                                                    <SolidColorBrush Color="#FFFFFFFF" Opacity="1" Transform="1.8458,0,0,1.8458,-121.06,-6.2579" />
+                                                </GeometryDrawing.Brush>
+                                                <GeometryDrawing.Pen>
+                                                    <Pen Brush="#FF000000" Thickness="1.6987" StartLineCap="Flat" EndLineCap="Flat" LineJoin="Round" />
+                                                </GeometryDrawing.Pen>
+                                                <GeometryDrawing.Geometry>
+                                                    <PathGeometry FillRule="EvenOdd" Transform="1.8458,0,0,1.8458,-121.06,-6.2579" Figures="M60,60z M0,0z M70.328,20.937C69.22,20.937,68.328,21.829,68.328,22.937L68.328,28.226C68.328,29.334,69.22,30.226,70.328,30.226L79.18,30.226C80.288,30.226,81.18,29.334,81.18,28.226L81.18,22.937C81.18,21.829,80.288,20.937,79.18,20.937L70.328,20.937z" />
+                                                </GeometryDrawing.Geometry>
+                                            </GeometryDrawing>
+                                        </DrawingGroup>
+                                    </DrawingGroup>
                                 </DrawingGroup>
                             </DrawingBrush.Drawing>
                         </DrawingBrush>

+ 96 - 10
SketchAssistant/SketchAssistantWPF/MainWindow.xaml.cs

@@ -28,7 +28,7 @@ namespace SketchAssistantWPF
             InitializeComponent();
             ProgramPresenter = new MVP_Presenter(this);
             //  DispatcherTimer setup
-            dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
+            dispatcherTimer = new DispatcherTimer();
             dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
             dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 33);
         }
@@ -57,49 +57,78 @@ namespace SketchAssistantWPF
         /// The Presenter Component of the MVP-Model
         /// </summary>
         MVP_Presenter ProgramPresenter;
+        /// <summary>
+        /// The line currently being drawn
+        /// </summary>
+        Polyline currentLine;
 
         /********************************************/
         /*** WINDOW SPECIFIC FUNCTIONS START HERE ***/
         /********************************************/
 
+        /// <summary>
+        /// Resize Function connected to the form resize event, will refresh the form when it is resized
+        /// </summary>
         private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
         {
-
+            ProgramPresenter.Resize(new Tuple<int, int>((int) LeftCanvas.Width, (int) LeftCanvas.Height),
+                new Tuple<int, int>((int) RightCanvas.Width, (int) RightCanvas.Height));
         }
 
+        /// <summary>
+        /// Redo an Action.
+        /// </summary>
         private void RedoButton_Click(object sender, RoutedEventArgs e)
         {
-
+            ProgramPresenter.Redo();
         }
 
+        /// <summary>
+        /// Undo an Action.
+        /// </summary>
         private void UndoButton_Click(object sender, RoutedEventArgs e)
         {
-
+            ProgramPresenter.Undo();
         }
 
+        /// <summary>
+        /// Changes the state of the program to deletion
+        /// </summary>
         private void DeleteButton_Click(object sender, RoutedEventArgs e)
         {
-
+            ProgramPresenter.ChangeState(false);
         }
 
+        /// <summary>
+        /// Changes the state of the program to drawing
+        /// </summary>
         private void DrawButton_Click(object sender, RoutedEventArgs e)
         {
-
+            ProgramPresenter.ChangeState(true);
         }
 
+        /// <summary>
+        /// Hold left mouse button to start drawing.
+        /// </summary>
         private void RightCanvas_MouseDown(object sender, MouseButtonEventArgs e)
         {
-
+            ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Down);
         }
 
+        /// <summary>
+        /// Lift left mouse button to stop drawing and add a new Line.
+        /// </summary>
         private void RightCanvas_MouseUp(object sender, MouseButtonEventArgs e)
         {
-
+            ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Up);
         }
 
+        /// <summary>
+        /// Get current Mouse positon within the right picture box.
+        /// </summary>
         private void RightCanvas_MouseMove(object sender, MouseEventArgs e)
         {
-
+            ProgramPresenter.MouseEvent(MVP_Presenter.MouseAction.Move, e.GetPosition(RightCanvas));
         }
 
         /// <summary>
@@ -123,7 +152,8 @@ namespace SketchAssistantWPF
         /*************************/
         /*** PRESENTER -> VIEW ***/
         /*************************/
-
+        
+            /*
         /// <summary>
         /// Displays a list of lines in the left Picture box.
         /// </summary>
@@ -152,6 +182,62 @@ namespace SketchAssistantWPF
                 newPolyLine.Points = line.GetPointCollection();
                 LeftCanvas.Children.Add(newPolyLine);
             }
+        }*/
+
+        /// <summary>
+        /// Remove the current line.
+        /// </summary>
+        public void RemoveCurrLine()
+        {
+            RightCanvas.Children.Remove(currentLine);
+        }
+
+        /// <summary>
+        /// Display the current line.
+        /// </summary>
+        /// <param name="line">The current line to display</param>
+        public void DisplayCurrLine(Polyline line)
+        {
+            if (RightCanvas.Children.Contains(currentLine))
+            {
+                RemoveCurrLine();
+            }
+            RightCanvas.Children.Add(line);
+            currentLine = line;
+        }
+
+        /// <summary>
+        /// Removes all Lines from the left canvas.
+        /// </summary>
+        public void RemoveAllLeftLines()
+        {
+            LeftCanvas.Children.Clear();
+        }
+
+        /// <summary>
+        /// Removes all lines in the right canvas.
+        /// </summary>
+        public void RemoveAllRightLines()
+        {
+            RightCanvas.Children.Clear();
+        }
+
+        /// <summary>
+        /// Adds another Line that will be displayed in the left display.
+        /// </summary>
+        /// <param name="newLine">The new Polyline to be added displayed.</param>
+        public void AddNewLineLeft(Polyline newLine)
+        {
+            LeftCanvas.Children.Add(newLine);
+        }
+
+        /// <summary>
+        /// Adds another Line that will be displayed in the right display.
+        /// </summary>
+        /// <param name="newLine">The new Polyline to be added displayed.</param>
+        public void AddNewLineRight(Polyline newLine)
+        {
+            RightCanvas.Children.Add(newLine);
         }
 
         /// <summary>

BIN
SketchAssistant/SketchAssistantWPF/Resources/NewCanvasIcon.ico


+ 1 - 3
SketchAssistant/SketchAssistantWPF/SketchAssistantWPF.csproj

@@ -60,6 +60,7 @@
     <Compile Include="FileImporter.cs" />
     <Compile Include="FileImporterException.cs" />
     <Compile Include="GeometryCalculator.cs" />
+    <Compile Include="ImageDimension.cs" />
     <Compile Include="SketchAction.cs" />
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
@@ -104,8 +105,5 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
-  <ItemGroup>
-    <None Include="Resources\NewCanvasIcon.ico" />
-  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>