MVP_Model.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Imaging;
  10. namespace SketchAssistantWPF
  11. {
  12. public class MVP_Model
  13. {
  14. /// <summary>
  15. /// The Presenter of the MVP-Model.
  16. /// </summary>
  17. MVP_Presenter programPresenter;
  18. /// <summary>
  19. /// History of Actions
  20. /// </summary>
  21. ActionHistory historyOfActions;
  22. /// <summary>
  23. /// The assistant responsible for the redraw mode
  24. /// </summary>
  25. //RedrawAssistant redrawAss;
  26. /*******************/
  27. /*** ENUMERATORS ***/
  28. /*******************/
  29. /***********************/
  30. /*** CLASS VARIABLES ***/
  31. /***********************/
  32. /// <summary>
  33. /// If the program is in drawing mode.
  34. /// </summary>
  35. bool inDrawingMode;
  36. /// <summary>
  37. /// If the mouse is currently pressed or not.
  38. /// </summary>
  39. bool mousePressed;
  40. /// <summary>
  41. /// Size of deletion area
  42. /// </summary>
  43. int deletionRadius = 5;
  44. /// <summary>
  45. /// Size of areas marking endpoints of lines in the redraw mode.
  46. /// </summary>
  47. int markerRadius = 10;
  48. /// <summary>
  49. /// The Position of the Cursor in the right picture box
  50. /// </summary>
  51. Point currentCursorPosition;
  52. /// <summary>
  53. /// The Previous Cursor Position in the right picture box
  54. /// </summary>
  55. Point previousCursorPosition;
  56. /// <summary>
  57. /// Queue for the cursorPositions
  58. /// </summary>
  59. Queue<Point> cursorPositions = new Queue<Point>();
  60. /// <summary>
  61. /// Lookup Matrix for checking postions of lines in the image
  62. /// </summary>
  63. bool[,] isFilledMatrix;
  64. /// <summary>
  65. /// Lookup Matrix for getting line ids at a certain postions of the image
  66. /// </summary>
  67. HashSet<int>[,] linesMatrix;
  68. /// <summary>
  69. /// List of items which will be overlayed over the right canvas.
  70. /// </summary>
  71. List<Tuple<bool, HashSet<Point>>> overlayItems;
  72. /// <summary>
  73. /// Width of the LeftImageBox.
  74. /// </summary>
  75. public int leftImageBoxWidth;
  76. /// <summary>
  77. /// Height of the LeftImageBox.
  78. /// </summary>
  79. public int leftImageBoxHeight;
  80. /// <summary>
  81. /// Width of the RightImageBox.
  82. /// </summary>
  83. public int rightImageBoxWidth;
  84. /// <summary>
  85. /// Height of the RightImageBox.
  86. /// </summary>
  87. public int rightImageBoxHeight;
  88. public ImageDimension leftImageSize { get; private set; }
  89. public ImageDimension rightImageSize { get; private set; }
  90. /// <summary>
  91. /// Indicates whether or not the canvas on the right side is active.
  92. /// </summary>
  93. public bool canvasActive {get; set;}
  94. /// <summary>
  95. /// Indicates if there is a graphic loaded in the left canvas.
  96. /// </summary>
  97. public bool graphicLoaded { get; set; }
  98. //Images
  99. Image leftImage;
  100. List<InternalLine> leftLineList;
  101. Image rightImageWithoutOverlay;
  102. Image rightImageWithOverlay;
  103. List<Tuple<bool, InternalLine>> rightLineList;
  104. List<Point> currentLine = new List<Point>();
  105. public MVP_Model(MVP_Presenter presenter)
  106. {
  107. programPresenter = presenter;
  108. historyOfActions = new ActionHistory();
  109. //redrawAss = new RedrawAssistant();
  110. //overlayItems = new List<Tuple<bool, HashSet<Point>>>();
  111. rightLineList = new List<Tuple<bool, InternalLine>>();
  112. canvasActive = false;
  113. UpdateUI();
  114. rightImageSize = new ImageDimension(0, 0);
  115. leftImageSize = new ImageDimension(0, 0);
  116. }
  117. /**************************/
  118. /*** NEW INTERNAL FUNCTIONS ***/
  119. /**************************/
  120. /// <summary>
  121. /// Change the status of whether or not the lines are shown.
  122. /// </summary>
  123. /// <param name="lines">The HashSet containing the affected Line IDs.</param>
  124. /// <param name="shown">True if the lines should be shown, false if they should be hidden.</param>
  125. private void ChangeLines(HashSet<int> lines, bool shown)
  126. {
  127. foreach (int lineId in lines)
  128. {
  129. if (lineId <= rightLineList.Count - 1 && lineId >= 0)
  130. {
  131. rightLineList[lineId] = new Tuple<bool, InternalLine>(shown, rightLineList[lineId].Item2);
  132. }
  133. }
  134. }
  135. /// <summary>
  136. /// A function that populates the matrixes needed for deletion detection with line data.
  137. /// </summary>
  138. private void RepopulateDeletionMatrixes()
  139. {
  140. if (canvasActive)
  141. {
  142. isFilledMatrix = new bool[rightImageSize.Width, rightImageSize.Height];
  143. linesMatrix = new HashSet<int>[rightImageSize.Width, rightImageSize.Height];
  144. foreach (Tuple<bool, InternalLine> lineTuple in rightLineList)
  145. {
  146. if (lineTuple.Item1)
  147. {
  148. lineTuple.Item2.PopulateMatrixes(isFilledMatrix, linesMatrix);
  149. }
  150. }
  151. }
  152. }
  153. /// <summary>
  154. /// Tells the Presenter to Update the UI
  155. /// </summary>
  156. private void UpdateUI()
  157. {
  158. programPresenter.UpdateUIState(inDrawingMode, historyOfActions.CanUndo(), historyOfActions.CanRedo(), canvasActive, graphicLoaded);
  159. }
  160. /// <summary>
  161. /// A function that checks the deletion matrixes at a certain point
  162. /// and returns all Line ids at that point and in a square around it in a certain range.
  163. /// </summary>
  164. /// <param name="p">The point around which to check.</param>
  165. /// <param name="range">The range around the point. If range is 0, only the point is checked.</param>
  166. /// <returns>A List of all lines.</returns>
  167. private HashSet<int> CheckDeletionMatrixesAroundPoint(Point p, int range)
  168. {
  169. HashSet<int> returnSet = new HashSet<int>();
  170. foreach (Point pnt in GeometryCalculator.FilledCircleAlgorithm(p, (int)range))
  171. {
  172. if (pnt.X >= 0 && pnt.Y >= 0 && pnt.X < rightImageSize.Width && pnt.Y < rightImageSize.Height)
  173. {
  174. if (isFilledMatrix[(int)pnt.X, (int)pnt.Y])
  175. {
  176. returnSet.UnionWith(linesMatrix[(int)pnt.X, (int)pnt.Y]);
  177. }
  178. }
  179. }
  180. return returnSet;
  181. }
  182. /********************************************/
  183. /*** NEW FUNCTIONS TO INTERACT WITH PRESENTER ***/
  184. /********************************************/
  185. /// <summary>
  186. /// A function to reset the right image.
  187. /// </summary>
  188. public void ResetRightImage()
  189. {
  190. rightLineList.Clear();
  191. programPresenter.PassLastActionTaken(historyOfActions.Reset());
  192. programPresenter.ClearRightLines();
  193. }
  194. /// <summary>
  195. /// The function to set the left image.
  196. /// </summary>
  197. /// <param name="width">The width of the left image.</param>
  198. /// <param name="height">The height of the left image.</param>
  199. /// <param name="listOfLines">The List of Lines to be displayed in the left image.</param>
  200. public void SetLeftLineList(int width, int height, List<InternalLine> listOfLines)
  201. {
  202. leftImageSize = new ImageDimension(width, height);
  203. rightImageSize = new ImageDimension(width, height);
  204. leftLineList = listOfLines;
  205. graphicLoaded = true;
  206. programPresenter.UpdateLeftLines(leftLineList);
  207. CanvasActivated();
  208. /*
  209. var workingCanvas = GetEmptyCanvas(width, height);
  210. var workingGraph = Graphics.FromImage(workingCanvas);
  211. leftLineList = listOfLines;
  212. //redrawAss = new RedrawAssistant(leftLineList);
  213. //overlayItems = redrawAss.Initialize(markerRadius);
  214. //Lines
  215. foreach (InternalLine line in leftLineList)
  216. {
  217. line.DrawLine(workingGraph);
  218. }
  219. leftImage = workingCanvas;
  220. programPresenter.UpdateLeftImage(leftImage);
  221. //Set right image to same size as left image and delete linelist
  222. DrawEmptyCanvasRight();
  223. rightLineList = new List<Tuple<bool, InternalLine>>();
  224. */
  225. }
  226. /// <summary>
  227. /// A function to tell the model a new canvas was activated.
  228. /// </summary>
  229. public void CanvasActivated()
  230. {
  231. canvasActive = true;
  232. RepopulateDeletionMatrixes();
  233. UpdateUI();
  234. }
  235. /// <summary>
  236. /// Will undo the last action taken, if the action history allows it.
  237. /// </summary>
  238. public void Undo()
  239. {
  240. if (historyOfActions.CanUndo())
  241. {
  242. HashSet<int> affectedLines = historyOfActions.GetCurrentAction().GetLineIDs();
  243. SketchAction.ActionType undoAction = historyOfActions.GetCurrentAction().GetActionType();
  244. switch (undoAction)
  245. {
  246. case SketchAction.ActionType.Delete:
  247. //Deleted Lines need to be shown
  248. ChangeLines(affectedLines, true);
  249. break;
  250. case SketchAction.ActionType.Draw:
  251. //Drawn lines need to be hidden
  252. ChangeLines(affectedLines, false);
  253. break;
  254. default:
  255. break;
  256. }
  257. //TODO: Add check if overlay needs to be added
  258. programPresenter.UpdateRightLines(rightLineList);
  259. }
  260. RepopulateDeletionMatrixes();
  261. programPresenter.PassLastActionTaken(historyOfActions.MoveAction(true));
  262. UpdateUI();
  263. }
  264. /// <summary>
  265. /// Will redo the last action undone, if the action history allows it.
  266. /// </summary>
  267. public void Redo()
  268. {
  269. if (historyOfActions.CanRedo())
  270. {
  271. programPresenter.PassLastActionTaken(historyOfActions.MoveAction(false));
  272. HashSet<int> affectedLines = historyOfActions.GetCurrentAction().GetLineIDs();
  273. SketchAction.ActionType redoAction = historyOfActions.GetCurrentAction().GetActionType();
  274. switch (redoAction)
  275. {
  276. case SketchAction.ActionType.Delete:
  277. //Deleted Lines need to be redeleted
  278. ChangeLines(affectedLines, false);
  279. break;
  280. case SketchAction.ActionType.Draw:
  281. //Drawn lines need to be redrawn
  282. ChangeLines(affectedLines, true);
  283. break;
  284. default:
  285. break;
  286. }
  287. //TODO: Add check if overlay needs to be added
  288. programPresenter.UpdateRightLines(rightLineList);
  289. RepopulateDeletionMatrixes();
  290. }
  291. UpdateUI();
  292. }
  293. /// <summary>
  294. /// The function called by the Presenter to change the drawing state of the program.
  295. /// </summary>
  296. /// <param name="nowDrawing">The new drawingstate of the program</param>
  297. public void ChangeState(bool nowDrawing)
  298. {
  299. inDrawingMode = nowDrawing;
  300. UpdateUI();
  301. }
  302. /// <summary>
  303. /// Updates the current cursor position of the model.
  304. /// </summary>
  305. /// <param name="p">The new cursor position</param>
  306. public void SetCurrentCursorPosition(Point p)
  307. {
  308. currentCursorPosition = p;
  309. }
  310. /// <summary>
  311. /// Start a new Line, when the Mouse is pressed down.
  312. /// </summary>
  313. public void MouseDown()
  314. {
  315. mousePressed = true;
  316. if (inDrawingMode)
  317. {
  318. currentLine.Clear();
  319. }
  320. }
  321. /// <summary>
  322. /// Finish the current Line, when the pressed Mouse is released.
  323. /// </summary>
  324. public void MouseUp()
  325. {
  326. mousePressed = false;
  327. if (inDrawingMode && currentLine.Count > 0)
  328. {
  329. InternalLine newLine = new InternalLine(currentLine, rightLineList.Count);
  330. rightLineList.Add(new Tuple<bool, InternalLine>(true, newLine));
  331. newLine.PopulateMatrixes(isFilledMatrix, linesMatrix);
  332. programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Draw, newLine.GetID())));
  333. //TODO: Add check if overlay needs to be added
  334. programPresenter.UpdateRightLines(rightLineList);
  335. currentLine.Clear();
  336. programPresenter.UpdateCurrentLine(currentLine);
  337. }
  338. UpdateUI();
  339. }
  340. /// <summary>
  341. /// Method to be called every tick. Updates the current Line, or checks for Lines to delete, depending on the drawing mode.
  342. /// </summary>
  343. public void Tick()
  344. {
  345. if (cursorPositions.Count > 0) { previousCursorPosition = cursorPositions.Dequeue(); }
  346. else { previousCursorPosition = currentCursorPosition; }
  347. cursorPositions.Enqueue(currentCursorPosition);
  348. //Drawing
  349. if (inDrawingMode && mousePressed)
  350. {
  351. currentLine.Add(currentCursorPosition);
  352. programPresenter.UpdateCurrentLine(currentLine);
  353. }
  354. //Deleting
  355. if (!inDrawingMode && mousePressed)
  356. {
  357. List<Point> uncheckedPoints = GeometryCalculator.BresenhamLineAlgorithm(previousCursorPosition, currentCursorPosition);
  358. foreach (Point currPoint in uncheckedPoints)
  359. {
  360. HashSet<int> linesToDelete = CheckDeletionMatrixesAroundPoint(currPoint, deletionRadius);
  361. if (linesToDelete.Count > 0)
  362. {
  363. programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Delete, linesToDelete)));
  364. foreach (int lineID in linesToDelete)
  365. {
  366. rightLineList[lineID] = new Tuple<bool, InternalLine>(false, rightLineList[lineID].Item2);
  367. }
  368. RepopulateDeletionMatrixes();
  369. //TODO: Add check if overlay needs to be added
  370. programPresenter.UpdateRightLines(rightLineList);
  371. }
  372. }
  373. }
  374. }
  375. /// <summary>
  376. /// A helper Function that updates the markerRadius & deletionRadius, considering the size of the canvas.
  377. /// </summary>
  378. /// <param name="CanvasSize">The size of the canvas</param>
  379. public void UpdateSizes(ImageDimension CanvasSize)
  380. {
  381. if (rightImageWithoutOverlay != null)
  382. {
  383. int widthImage = rightImageSize.Width;
  384. int heightImage = rightImageSize.Height;
  385. int widthBox = CanvasSize.Width;
  386. int heightBox = CanvasSize.Height;
  387. float imageRatio = (float)widthImage / (float)heightImage;
  388. float containerRatio = (float)widthBox / (float)heightBox;
  389. float zoomFactor = 0;
  390. if (imageRatio >= containerRatio)
  391. {
  392. //Image is wider than it is high
  393. zoomFactor = (float)widthImage / (float)widthBox;
  394. }
  395. else
  396. {
  397. //Image is higher than it is wide
  398. zoomFactor = (float)heightImage / (float)heightBox;
  399. }
  400. markerRadius = (int)(10 * zoomFactor);
  401. deletionRadius = (int)(5 * zoomFactor);
  402. }
  403. }
  404. /// <summary>
  405. /// If there is unsaved progress.
  406. /// </summary>
  407. /// <returns>True if there is progress that has not been saved.</returns>
  408. public bool HasUnsavedProgress()
  409. {
  410. return !historyOfActions.IsEmpty();
  411. }
  412. /**************************/
  413. /*** INTERNAL FUNCTIONS ***/
  414. /**************************/
  415. /*
  416. /// <summary>
  417. /// A function that returns a white canvas for a given width and height.
  418. /// </summary>
  419. /// <param name="width">The width of the canvas in pixels</param>
  420. /// <param name="height">The height of the canvas in pixels</param>
  421. /// <returns>The new canvas</returns>
  422. private Image GetEmptyCanvas(int width, int height)
  423. {
  424. Image image;
  425. WriteableBitmap newCanvas;
  426. try
  427. {
  428. newCanvas = new WriteableBitmap(width, height, 96, 96, PixelFormats.Bgra32, null);
  429. image = new Bitmap(width, height);
  430. }
  431. catch (ArgumentException e)
  432. {
  433. programPresenter.PassMessageToView("The requested canvas size caused an error: \n"
  434. + e.ToString() + "\n The Canvas will be set to match your window.");
  435. newCanvas = new WriteableBitmap(leftImageBoxWidth, leftImageBoxHeight, 96, 96, PixelFormats.Bgra32, null);
  436. }
  437. newCanvas.WritePixels()
  438. Graphics graph = Graphics.FromImage(image);
  439. graph.FillRectangle(Brushes.White, 0, 0, width + 10, height + 10);
  440. return image;
  441. }
  442. /// <summary>
  443. /// Creates an empty Canvas on the left
  444. /// </summary>
  445. /// <param name="width"> width of the new canvas in pixels </param>
  446. /// <param name="height"> height of the new canvas in pixels </param>
  447. private void DrawEmptyCanvasLeft(int width, int height)
  448. {
  449. if (width == 0)
  450. {
  451. leftImage = GetEmptyCanvas(leftImageBoxWidth, leftImageBoxHeight);
  452. }
  453. else
  454. {
  455. leftImage = GetEmptyCanvas(width, height);
  456. }
  457. programPresenter.UpdateLeftImage(leftImage);
  458. }
  459. /// <summary>
  460. /// Redraws all lines in rightLineList, for which their associated boolean value equals true and calls RedrawRightOverlay.
  461. /// </summary>
  462. private void RedrawRightImage()
  463. {
  464. var workingCanvas = GetEmptyCanvas(rightImageWithoutOverlay.Width, rightImageWithoutOverlay.Height);
  465. var workingGraph = Graphics.FromImage(workingCanvas);
  466. //Lines
  467. foreach (Tuple<bool, InternalLine> lineBoolTuple in rightLineList)
  468. {
  469. if (lineBoolTuple.Item1)
  470. {
  471. lineBoolTuple.Item2.DrawLine(workingGraph);
  472. }
  473. }
  474. //The Line being currently drawn
  475. if (currentLine != null && currentLine.Count > 0 && inDrawingMode && mousePressed)
  476. {
  477. var currLine = new InternalLine(currentLine);
  478. currLine.DrawLine(workingGraph);
  479. }
  480. rightImageWithoutOverlay = workingCanvas;
  481. //Redraw the Overlay if needed
  482. if (leftImage != null)
  483. {
  484. RedrawRightOverlay();
  485. }
  486. else
  487. {
  488. programPresenter.UpdateRightImage(rightImageWithoutOverlay);
  489. }
  490. }
  491. /// <summary>
  492. /// Redraws all elements in the overlay items for which the respective boolean value is true.
  493. /// </summary>
  494. private void RedrawRightOverlay()
  495. {
  496. var workingCanvas = rightImageWithoutOverlay;
  497. var workingGraph = Graphics.FromImage(workingCanvas);
  498. foreach (Tuple<bool, HashSet<Point>> tup in overlayItems)
  499. {
  500. if (tup.Item1)
  501. {
  502. foreach (Point p in tup.Item2)
  503. {
  504. workingGraph.FillRectangle(Brushes.Green, p.X, p.Y, 1, 1);
  505. }
  506. }
  507. }
  508. rightImageWithOverlay = workingCanvas;
  509. programPresenter.UpdateRightImage(rightImageWithOverlay);
  510. }
  511. */
  512. /*
  513. /// <summary>
  514. /// Will calculate the start and endpoints of the given line on the right canvas.
  515. /// </summary>
  516. /// <param name="line">The line.</param>
  517. /// <param name="size">The size of the circle with which the endpoints of the line are marked.</param>
  518. private Tuple<HashSet<Point>, HashSet<Point>> CalculateStartAndEnd(Line line, int size)
  519. {
  520. var circle0 = GeometryCalculator.FilledCircleAlgorithm(line.GetStartPoint(), size);
  521. var circle1 = GeometryCalculator.FilledCircleAlgorithm(line.GetEndPoint(), size);
  522. var currentLineEndings = new Tuple<HashSet<Point>, HashSet<Point>>(circle0, circle1);
  523. return currentLineEndings;
  524. }
  525. */
  526. /********************************************/
  527. /*** FUNCTIONS TO INTERACT WITH PRESENTER ***/
  528. /********************************************/
  529. /*
  530. /// <summary>
  531. /// Creates an empty Canvas
  532. /// </summary>
  533. public void DrawEmptyCanvasRight()
  534. {
  535. if (leftImage == null)
  536. {
  537. rightImageWithoutOverlay = GetEmptyCanvas(leftImageBoxWidth, leftImageBoxHeight);
  538. }
  539. else
  540. {
  541. rightImageWithoutOverlay = GetEmptyCanvas(leftImage.Width, leftImage.Height);
  542. }
  543. RepopulateDeletionMatrixes();
  544. rightImageWithOverlay = rightImageWithoutOverlay;
  545. programPresenter.UpdateRightImage(rightImageWithOverlay);
  546. }
  547. /// <summary>
  548. /// A method to get the dimensions of the right image.
  549. /// </summary>
  550. /// <returns>A tuple containing the width and height of the right image.</returns>
  551. public Tuple<int, int> GetRightImageDimensions()
  552. {
  553. if (rightImageWithoutOverlay != null)
  554. {
  555. return new Tuple<int, int>(rightImageWithoutOverlay.Width, rightImageWithoutOverlay.Height);
  556. }
  557. else
  558. {
  559. return new Tuple<int, int>(0, 0);
  560. }
  561. }
  562. /// <summary>
  563. /// Method to be called every tick. Updates the current Line, or checks for Lines to delete, depending on the drawing mode.
  564. /// </summary>
  565. public void Tick()
  566. {
  567. if (cursorPositions.Count > 0) { previousCursorPosition = cursorPositions.Dequeue(); }
  568. else { previousCursorPosition = currentCursorPosition; }
  569. cursorPositions.Enqueue(currentCursorPosition);
  570. //Drawing
  571. if (inDrawingMode && mousePressed)
  572. {
  573. var rightGraph = Graphics.FromImage(rightImageWithoutOverlay);
  574. currentLine.Add(currentCursorPosition);
  575. InternalLine drawline = new InternalLine(currentLine);
  576. drawline.DrawLine(rightGraph);
  577. RedrawRightOverlay();
  578. }
  579. //Deleting
  580. if (!inDrawingMode && mousePressed)
  581. {
  582. List<Point> uncheckedPoints = GeometryCalculator.BresenhamLineAlgorithm(previousCursorPosition, currentCursorPosition);
  583. foreach (Point currPoint in uncheckedPoints)
  584. {
  585. HashSet<int> linesToDelete = CheckDeletionMatrixesAroundPoint(currPoint, deletionRadius);
  586. if (linesToDelete.Count > 0)
  587. {
  588. programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Delete, linesToDelete)));
  589. foreach (int lineID in linesToDelete)
  590. {
  591. rightLineList[lineID] = new Tuple<bool, InternalLine>(false, rightLineList[lineID].Item2);
  592. }
  593. RepopulateDeletionMatrixes();
  594. if (leftImage != null)
  595. {
  596. //Redraw overlay gets ticked
  597. //overlayItems = redrawAss.Tick(currentCursorPosition, rightLineList, -1, false);
  598. }
  599. RedrawRightImage();
  600. }
  601. }
  602. }
  603. }
  604. */
  605. }
  606. }