MVP_Model.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Controls;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Imaging;
  10. using OptiTrack;
  11. using System.Runtime.InteropServices;
  12. using System.IO;
  13. namespace SketchAssistantWPF
  14. {
  15. public class MVP_Model
  16. {
  17. /// <summary>
  18. /// The Presenter of the MVP-Model.
  19. /// </summary>
  20. MVP_Presenter programPresenter;
  21. /// <summary>
  22. /// History of Actions
  23. /// </summary>
  24. ActionHistory historyOfActions;
  25. OptiTrackConnector connector;
  26. /***********************/
  27. /*** CLASS VARIABLES ***/
  28. /***********************/
  29. /// <summary>
  30. /// If the program is in drawing mode.
  31. /// </summary>
  32. bool inDrawingMode;
  33. /// <summary>
  34. /// if the program is using OptiTrack
  35. /// </summary>
  36. public bool optiTrackInUse { get; private set; }
  37. /// <summary>
  38. /// Size of deletion area
  39. /// </summary>
  40. int deletionRadius = 5;
  41. /// <summary>
  42. /// Size of areas marking endpoints of lines in the redraw mode.
  43. /// </summary>
  44. int markerRadius = 10;
  45. /// <summary>
  46. /// The Position of the Cursor in the right picture box
  47. /// </summary>
  48. Point currentCursorPosition;
  49. /// <summary>
  50. /// The Previous Cursor Position in the right picture box
  51. /// </summary>
  52. Point previousCursorPosition;
  53. /// <summary>
  54. /// Queue for the cursorPositions
  55. /// </summary>
  56. Queue<Point> cursorPositions = new Queue<Point>();
  57. /// <summary>
  58. /// Lookup Matrix for checking postions of lines in the image
  59. /// </summary>
  60. bool[,] isFilledMatrix;
  61. /// <summary>
  62. /// Lookup Matrix for getting line ids at a certain postions of the image
  63. /// </summary>
  64. HashSet<int>[,] linesMatrix;
  65. /// <summary>
  66. /// List of items which will be overlayed over the right canvas.
  67. /// </summary>
  68. List<Tuple<bool, HashSet<Point>>> overlayItems;
  69. /// <summary>
  70. /// Width of the LeftImageBox.
  71. /// </summary>
  72. public int leftImageBoxWidth;
  73. /// <summary>
  74. /// Height of the LeftImageBox.
  75. /// </summary>
  76. public int leftImageBoxHeight;
  77. /// <summary>
  78. /// Width of the RightImageBox.
  79. /// </summary>
  80. public int rightImageBoxWidth;
  81. /// <summary>
  82. /// Height of the RightImageBox.
  83. /// </summary>
  84. public int rightImageBoxHeight;
  85. public ImageDimension leftImageSize { get; private set; }
  86. public ImageDimension rightImageSize { get; private set; }
  87. /// <summary>
  88. /// Indicates whether or not the canvas on the right side is active.
  89. /// </summary>
  90. public bool canvasActive { get; set; }
  91. /// <summary>
  92. /// Indicates if there is a graphic loaded in the left canvas.
  93. /// </summary>
  94. public bool graphicLoaded { get; set; }
  95. /// <summary>
  96. /// Whether or not an optitrack system is avaiable.
  97. /// </summary>
  98. public bool optitrackAvailable { get; private set; }
  99. //TODO: calibrate
  100. double OPTITRACK_X_OFFSET = 0.7878;
  101. double OPTITRACK_Y_OFFSET = 0.7977;
  102. double OPTITRACK_CANVAS_HEIGHT = 1.29;
  103. double OPTITRACK_X_SCALE = -0.254 * (((1.816 / 0.0254) * 96) / (1.816));
  104. double OPTITRACK_Y_SCALE = 0.254 * (((1.360 / 0.0254) * 96) / (1.360));
  105. Image rightImageWithoutOverlay;
  106. /// Whether or not the mouse is pressed.
  107. /// </summary>
  108. private bool mouseDown;
  109. List<InternalLine> leftLineList;
  110. List<Tuple<bool, InternalLine>> rightLineList;
  111. List<Point> currentLine = new List<Point>();
  112. public MVP_Model(MVP_Presenter presenter)
  113. {
  114. programPresenter = presenter;
  115. historyOfActions = new ActionHistory();
  116. //redrawAss = new RedrawAssistant();
  117. //overlayItems = new List<Tuple<bool, HashSet<Point>>>();
  118. rightLineList = new List<Tuple<bool, InternalLine>>();
  119. canvasActive = false;
  120. UpdateUI();
  121. rightImageSize = new ImageDimension(0, 0);
  122. leftImageSize = new ImageDimension(0, 0);
  123. connector = new OptiTrackConnector();
  124. armband = new Armband();
  125. optitrackAvailable = false;
  126. if (File.Exists(@"C:\Users\videowall-pc-user\Documents\BP-SketchAssistant\SketchAssistant\optitrack_setup.ttp"))
  127. {
  128. if (connector.Init(@"C:\Users\videowall-pc-user\Documents\BP-SketchAssistant\SketchAssistant\optitrack_setup.ttp"))
  129. {
  130. optitrackAvailable = true;
  131. connector.StartTracking(getOptiTrackPosition);
  132. }
  133. }
  134. }
  135. [DllImport("user32.dll", EntryPoint = "SetCursorPos")]
  136. private static extern bool SetCursorPos(int X, int Y);
  137. //[DllImport("user32.dll")]
  138. //public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
  139. public enum MouseEventType : int
  140. {
  141. LeftDown = 0x02,
  142. LeftUp = 0x04,
  143. RightDown = 0x08,
  144. RightUp = 0x10
  145. }
  146. /**************************/
  147. /*** INTERNAL FUNCTIONS ***/
  148. /**************************/
  149. /// <summary>
  150. /// Change the status of whether or not the lines are shown.
  151. /// </summary>
  152. /// <param name="lines">The HashSet containing the affected Line IDs.</param>
  153. /// <param name="shown">True if the lines should be shown, false if they should be hidden.</param>
  154. private void ChangeLines(HashSet<int> lines, bool shown)
  155. {
  156. foreach (int lineId in lines)
  157. {
  158. if (lineId <= rightLineList.Count - 1 && lineId >= 0)
  159. {
  160. rightLineList[lineId] = new Tuple<bool, InternalLine>(shown, rightLineList[lineId].Item2);
  161. }
  162. }
  163. }
  164. /// <summary>
  165. /// A function that populates the matrixes needed for deletion detection with line data.
  166. /// </summary>
  167. private void RepopulateDeletionMatrixes()
  168. {
  169. if (canvasActive)
  170. {
  171. isFilledMatrix = new bool[rightImageSize.Width, rightImageSize.Height];
  172. linesMatrix = new HashSet<int>[rightImageSize.Width, rightImageSize.Height];
  173. foreach (Tuple<bool, InternalLine> lineTuple in rightLineList)
  174. {
  175. if (lineTuple.Item1)
  176. {
  177. lineTuple.Item2.PopulateMatrixes(isFilledMatrix, linesMatrix);
  178. }
  179. }
  180. }
  181. }
  182. /// <summary>
  183. /// Tells the Presenter to Update the UI
  184. /// </summary>
  185. private void UpdateUI()
  186. {
  187. programPresenter.UpdateUIState(inDrawingMode, historyOfActions.CanUndo(), historyOfActions.CanRedo(), canvasActive, graphicLoaded, optitrackAvailable, optiTrackInUse);
  188. }
  189. /// <summary>
  190. /// A function that checks the deletion matrixes at a certain point
  191. /// and returns all Line ids at that point and in a square around it in a certain range.
  192. /// </summary>
  193. /// <param name="p">The point around which to check.</param>
  194. /// <param name="range">The range around the point. If range is 0, only the point is checked.</param>
  195. /// <returns>A List of all lines.</returns>
  196. private HashSet<int> CheckDeletionMatrixesAroundPoint(Point p, int range)
  197. {
  198. HashSet<int> returnSet = new HashSet<int>();
  199. foreach (Point pnt in GeometryCalculator.FilledCircleAlgorithm(p, (int)range))
  200. {
  201. if (pnt.X >= 0 && pnt.Y >= 0 && pnt.X < rightImageSize.Width && pnt.Y < rightImageSize.Height)
  202. {
  203. if (isFilledMatrix[(int)pnt.X, (int)pnt.Y])
  204. {
  205. returnSet.UnionWith(linesMatrix[(int)pnt.X, (int)pnt.Y]);
  206. }
  207. }
  208. }
  209. return returnSet;
  210. }
  211. /********************************************/
  212. /*** FUNCTIONS TO INTERACT WITH PRESENTER ***/
  213. /********************************************/
  214. /// <summary>
  215. /// A function to update the dimensions of the left and right canvas when the window is resized.
  216. /// </summary>
  217. /// <param name="LeftCanvas">The size of the left canvas.</param>
  218. /// <param name="RightCanvas">The size of the right canvas.</param>
  219. public void ResizeEvent(ImageDimension LeftCanvas, ImageDimension RightCanvas)
  220. {
  221. if (LeftCanvas.Height >= 0 && LeftCanvas.Width >= 0) { leftImageSize = LeftCanvas; }
  222. if (RightCanvas.Height >= 0 && RightCanvas.Width >= 0) { rightImageSize = RightCanvas; }
  223. RepopulateDeletionMatrixes();
  224. }
  225. /// <summary>
  226. /// A function to reset the right image.
  227. /// </summary>
  228. public void ResetRightImage()
  229. {
  230. rightLineList.Clear();
  231. programPresenter.PassLastActionTaken(historyOfActions.Reset());
  232. programPresenter.ClearRightLines();
  233. }
  234. /// <summary>
  235. /// The function to set the left image.
  236. /// </summary>
  237. /// <param name="width">The width of the left image.</param>
  238. /// <param name="height">The height of the left image.</param>
  239. /// <param name="listOfLines">The List of Lines to be displayed in the left image.</param>
  240. public void SetLeftLineList(int width, int height, List<InternalLine> listOfLines)
  241. {
  242. leftImageSize = new ImageDimension(width, height);
  243. rightImageSize = new ImageDimension(width, height);
  244. leftLineList = listOfLines;
  245. graphicLoaded = true;
  246. programPresenter.UpdateLeftLines(leftLineList);
  247. CanvasActivated();
  248. /*
  249. var workingCanvas = GetEmptyCanvas(width, height);
  250. var workingGraph = Graphics.FromImage(workingCanvas);
  251. leftLineList = listOfLines;
  252. //redrawAss = new RedrawAssistant(leftLineList);
  253. //overlayItems = redrawAss.Initialize(markerRadius);
  254. //Lines
  255. foreach (InternalLine line in leftLineList)
  256. {
  257. line.DrawLine(workingGraph);
  258. }
  259. leftImage = workingCanvas;
  260. programPresenter.UpdateLeftImage(leftImage);
  261. //Set right image to same size as left image and delete linelist
  262. DrawEmptyCanvasRight();
  263. rightLineList = new List<Tuple<bool, InternalLine>>();
  264. */
  265. }
  266. /// <summary>
  267. /// A function to tell the model a new canvas was activated.
  268. /// </summary>
  269. public void CanvasActivated()
  270. {
  271. canvasActive = true;
  272. RepopulateDeletionMatrixes();
  273. UpdateUI();
  274. }
  275. /// <summary>
  276. /// Will undo the last action taken, if the action history allows it.
  277. /// </summary>
  278. public void Undo()
  279. {
  280. if (historyOfActions.CanUndo())
  281. {
  282. HashSet<int> affectedLines = historyOfActions.GetCurrentAction().GetLineIDs();
  283. SketchAction.ActionType undoAction = historyOfActions.GetCurrentAction().GetActionType();
  284. switch (undoAction)
  285. {
  286. case SketchAction.ActionType.Delete:
  287. //Deleted Lines need to be shown
  288. ChangeLines(affectedLines, true);
  289. break;
  290. case SketchAction.ActionType.Draw:
  291. //Drawn lines need to be hidden
  292. ChangeLines(affectedLines, false);
  293. break;
  294. default:
  295. break;
  296. }
  297. //TODO: For the person implementing overlay: Add check if overlay needs to be added
  298. programPresenter.UpdateRightLines(rightLineList);
  299. }
  300. RepopulateDeletionMatrixes();
  301. programPresenter.PassLastActionTaken(historyOfActions.MoveAction(true));
  302. UpdateUI();
  303. }
  304. /// <summary>
  305. /// Will redo the last action undone, if the action history allows it.
  306. /// </summary>
  307. public void Redo()
  308. {
  309. if (historyOfActions.CanRedo())
  310. {
  311. programPresenter.PassLastActionTaken(historyOfActions.MoveAction(false));
  312. HashSet<int> affectedLines = historyOfActions.GetCurrentAction().GetLineIDs();
  313. SketchAction.ActionType redoAction = historyOfActions.GetCurrentAction().GetActionType();
  314. switch (redoAction)
  315. {
  316. case SketchAction.ActionType.Delete:
  317. //Deleted Lines need to be redeleted
  318. ChangeLines(affectedLines, false);
  319. break;
  320. case SketchAction.ActionType.Draw:
  321. //Drawn lines need to be redrawn
  322. ChangeLines(affectedLines, true);
  323. break;
  324. default:
  325. break;
  326. }
  327. //TODO: For the person implementing overlay: Add check if overlay needs to be added
  328. programPresenter.UpdateRightLines(rightLineList);
  329. RepopulateDeletionMatrixes();
  330. }
  331. UpdateUI();
  332. }
  333. /// <summary>
  334. /// The function called by the Presenter to change the drawing state of the program.
  335. /// </summary>
  336. /// <param name="nowDrawing">The new drawingstate of the program</param>
  337. public void ChangeState(bool nowDrawing)
  338. {
  339. inDrawingMode = nowDrawing;
  340. UpdateUI();
  341. }
  342. /// <summary>
  343. /// The function called by the Presenter to set a variable which describes if OptiTrack is in use
  344. /// </summary>
  345. /// <param name="usingOptiTrack"></param>
  346. public void SetOptiTrack(bool usingOptiTrack)
  347. {
  348. optiTrackInUse = usingOptiTrack;
  349. if (usingOptiTrack && optiTrackX == 0 && optiTrackY == 0 && optiTrackZ == 0)
  350. {
  351. programPresenter.PassMessageToView("Trackable not detected, please check if OptiTrack is activated and Trackable is recognized", "Warning");
  352. }
  353. }
  354. /// <summary>
  355. /// Updates the current cursor position of the model.
  356. /// </summary>
  357. /// <param name="p">The new cursor position</param>
  358. public void SetCurrentCursorPosition(Point p)
  359. {
  360. if (!optiTrackInUse) currentCursorPosition = p;
  361. mouseDown = programPresenter.IsMousePressed();
  362. }
  363. /// <summary>
  364. /// Updates the current cursor position of the model.
  365. /// </summary>
  366. /// <param name="p">The new cursor position</param>
  367. public void SetCurrentFingerPosition(Point p)
  368. {
  369. Console.WriteLine("raw coordinates: " + p.X + ";" + p.Y);
  370. Point correctedPoint = ConvertTo96thsOfInch(p);
  371. Console.WriteLine(correctedPoint.X + "," + correctedPoint.Y);
  372. currentCursorPosition = correctedPoint;
  373. }
  374. private Point ConvertTo96thsOfInch(Point p)
  375. {
  376. double xCoordinate = (p.X - OPTITRACK_X_OFFSET) * OPTITRACK_X_SCALE;
  377. double yCoordinate = (OPTITRACK_CANVAS_HEIGHT - (p.Y - OPTITRACK_Y_OFFSET)) * OPTITRACK_Y_SCALE;
  378. return new Point(xCoordinate, yCoordinate);
  379. }
  380. private Point ConvertToPixel(Point p)
  381. {
  382. double xCoordinate = (p.X - OPTITRACK_X_OFFSET) * -1 * (/*Anzahl Pixel X-Richtung*/0 / (1.816)) + 0/*1/2 * x-richtung pixel*/; //TODO
  383. double yCoordinate = (((OPTITRACK_CANVAS_HEIGHT + 0/*meter von oberer Rand Leinwand zu oberer Rand Bildschirm*/) - (p.Y - OPTITRACK_Y_OFFSET))) * (/*Anzahl Pixel Y-Richtung*/0 / (1.360));
  384. return new Point(xCoordinate, yCoordinate);
  385. }
  386. /// <summary>
  387. /// Start a new Line, when the Mouse is pressed down.
  388. /// </summary>
  389. public void StartNewLine()
  390. {
  391. if (optiTrackInUse || programPresenter.IsMousePressed())
  392. {
  393. if (inDrawingMode)
  394. {
  395. currentLine.Clear();
  396. currentLine.Add(currentCursorPosition);
  397. }
  398. }
  399. }
  400. /// <summary>
  401. /// Finish the current Line, when the pressed Mouse is released.
  402. /// </summary>
  403. /// <param name="valid">Whether the up event is valid or not</param>
  404. public void FinishCurrentLine(bool valid)
  405. {
  406. foreach (Point p in currentLine)
  407. {
  408. Console.WriteLine(p.X + ";" + p.Y);
  409. }
  410. if (valid)
  411. {
  412. if (inDrawingMode && currentLine.Count > 0)
  413. {
  414. InternalLine newLine = new InternalLine(currentLine, rightLineList.Count);
  415. rightLineList.Add(new Tuple<bool, InternalLine>(true, newLine));
  416. newLine.PopulateMatrixes(isFilledMatrix, linesMatrix);
  417. programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Draw, newLine.GetID())));
  418. //TODO: For the person implementing overlay: Add check if overlay needs to be added
  419. programPresenter.UpdateRightLines(rightLineList);
  420. currentLine.Clear();
  421. programPresenter.UpdateCurrentLine(currentLine);
  422. }
  423. }
  424. else
  425. {
  426. currentLine.Clear();
  427. }
  428. UpdateUI();
  429. }
  430. public float optiTrackX;
  431. public float optiTrackY;
  432. public float optiTrackZ;
  433. private bool optiTrackInsideDrawingZone = false;
  434. private double WARNING_ZONE_BOUNDARY = 0.10; //5cm
  435. private Armband armband;
  436. void getOptiTrackPosition(OptiTrack.Frame frame)
  437. {
  438. optiTrackX = frame.Trackables[0].X;
  439. optiTrackY = frame.Trackables[0].Y;
  440. optiTrackZ = frame.Trackables[0].Z;
  441. }
  442. /// <summary>
  443. /// Method to be called every tick. Updates the current Line, or checks for Lines to delete, depending on the drawing mode.
  444. /// </summary>
  445. public void Tick()
  446. {
  447. if (cursorPositions.Count > 0) { previousCursorPosition = cursorPositions.Dequeue(); }
  448. else { previousCursorPosition = currentCursorPosition; }
  449. if (optiTrackInUse)
  450. {
  451. if (CheckInsideDrawingZone(optiTrackZ))
  452. {
  453. SetCurrentFingerPosition(new Point(optiTrackX, optiTrackY));
  454. currentLine.Add(currentCursorPosition);
  455. programPresenter.UpdateCurrentLine(currentLine);
  456. if (!optiTrackInsideDrawingZone)
  457. {
  458. optiTrackInsideDrawingZone = true;
  459. StartNewLine();
  460. Console.WriteLine("new line begun");
  461. }
  462. if (optiTrackZ > WARNING_ZONE_BOUNDARY)
  463. {
  464. armband.pushForward();
  465. }
  466. else if (optiTrackZ < -1 * WARNING_ZONE_BOUNDARY)
  467. {
  468. armband.pushBackward();
  469. }
  470. }
  471. else
  472. {
  473. if (optiTrackInsideDrawingZone) //trackable was in drawing zone last tick -> finish line
  474. {
  475. optiTrackInsideDrawingZone = false;
  476. FinishCurrentLine(true);
  477. Console.WriteLine("line finished");
  478. }
  479. }
  480. //if (optitrackAvailable) { TODO test and remove
  481. projectPointOntoScreen(optiTrackX, optiTrackY);
  482. //}
  483. cursorPositions.Enqueue(currentCursorPosition);
  484. }
  485. else
  486. {
  487. cursorPositions.Enqueue(currentCursorPosition);
  488. if (inDrawingMode && programPresenter.IsMousePressed())
  489. {
  490. currentLine.Add(currentCursorPosition);
  491. //programPresenter.UpdateCurrentLine(currentLine);
  492. }
  493. }
  494. //Deleting
  495. if (!inDrawingMode && programPresenter.IsMousePressed())
  496. {
  497. List<Point> uncheckedPoints = GeometryCalculator.BresenhamLineAlgorithm(previousCursorPosition, currentCursorPosition);
  498. foreach (Point currPoint in uncheckedPoints)
  499. {
  500. HashSet<int> linesToDelete = CheckDeletionMatrixesAroundPoint(currPoint, deletionRadius);
  501. if (linesToDelete.Count > 0)
  502. {
  503. programPresenter.PassLastActionTaken(historyOfActions.AddNewAction(new SketchAction(SketchAction.ActionType.Delete, linesToDelete)));
  504. foreach (int lineID in linesToDelete)
  505. {
  506. rightLineList[lineID] = new Tuple<bool, InternalLine>(false, rightLineList[lineID].Item2);
  507. }
  508. RepopulateDeletionMatrixes();
  509. //TODO: For the person implementing overlay: Add check if overlay needs to be added
  510. programPresenter.UpdateRightLines(rightLineList);
  511. }
  512. }
  513. }
  514. }
  515. private void projectPointOntoScreen(float optiTrackX, float optiTrackY)
  516. {
  517. Point auxiliaryPoint = ConvertToPixel(new Point(optiTrackX, optiTrackY));
  518. SetCursorPos((int)auxiliaryPoint.X, (int)auxiliaryPoint.Y);
  519. }
  520. private bool CheckInsideDrawingZone(float optiTrackZ)
  521. {
  522. if (Math.Abs(optiTrackZ) > WARNING_ZONE_BOUNDARY * 2) return false;
  523. return true;
  524. }
  525. /*
  526. /// <summary>
  527. /// A helper Function that updates the markerRadius & deletionRadius, considering the size of the canvas.
  528. /// </summary>
  529. /// <param name="CanvasSize">The size of the canvas</param>
  530. public void UpdateSizes(ImageDimension CanvasSize)
  531. {
  532. if (rightImageWithoutOverlay != null)
  533. {
  534. int widthImage = rightImageSize.Width;
  535. int heightImage = rightImageSize.Height;
  536. int widthBox = CanvasSize.Width;
  537. int heightBox = CanvasSize.Height;
  538. float imageRatio = (float)widthImage / (float)heightImage;
  539. float containerRatio = (float)widthBox / (float)heightBox;
  540. float zoomFactor = 0;
  541. if (imageRatio >= containerRatio)
  542. {
  543. //Image is wider than it is high
  544. zoomFactor = (float)widthImage / (float)widthBox;
  545. }
  546. else
  547. {
  548. //Image is higher than it is wide
  549. zoomFactor = (float)heightImage / (float)heightBox;
  550. }
  551. markerRadius = (int)(10 * zoomFactor);
  552. deletionRadius = (int)(5 * zoomFactor);
  553. }
  554. }
  555. */
  556. /// <summary>
  557. /// If there is unsaved progress.
  558. /// </summary>
  559. /// <returns>True if there is progress that has not been saved.</returns>
  560. public bool HasUnsavedProgress()
  561. {
  562. return !historyOfActions.IsEmpty();
  563. }
  564. }
  565. }