Lines.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using SkiaSharp;
  6. namespace FlowChartV2.Libraries
  7. {
  8. public class Lines
  9. {
  10. public Figure figure1 { get; set; }
  11. public Figure figure2 { get; set; }
  12. public Lines(Figure first, Figure second)
  13. {
  14. this.figure1 = first;
  15. this.figure2 = second;
  16. }
  17. public void DrawLeft(ref SKCanvas canvas, SKPaint paint)
  18. {
  19. SKPoint[] points =
  20. {
  21. new SKPoint(figure1.bottom.x,figure1.bottom.y),
  22. new SKPoint(figure1.bottom.x,figure1.bottom.y+10),
  23. new SKPoint(figure1.bottom.x,figure1.bottom.y+10),
  24. new SKPoint(figure2.left.x - 10,figure1.bottom.y + 10),
  25. new SKPoint(figure2.left.x - 10,figure1.bottom.y + 10),
  26. new SKPoint(figure2.left.x - 10,figure2.left.y),
  27. new SKPoint(figure2.left.x - 10,figure2.left.y),
  28. new SKPoint(figure2.left.x,figure2.left.y),
  29. };
  30. canvas.DrawPoints(SKPointMode.Lines, points, paint);
  31. SKPoint[] arrow =
  32. {
  33. new SKPoint(figure2.left.x - 5,figure2.left.y - 3),
  34. new SKPoint(figure2.left.x,figure2.left.y),
  35. new SKPoint(figure2.left.x,figure2.left.y),
  36. new SKPoint(figure2.left.x - 5,figure2.left.y + 3),
  37. };
  38. canvas.DrawPoints(SKPointMode.Lines, arrow, paint);
  39. }
  40. public void DrawRight(ref SKCanvas canvas, SKPaint paint)
  41. {
  42. SKPoint[] points =
  43. {
  44. new SKPoint(figure1.right.x,figure1.right.y),
  45. new SKPoint(figure1.right.x + figure2.size.w / 4,figure1.right.y),
  46. new SKPoint(figure1.right.x + figure2.size.w / 4,figure1.right.y),
  47. new SKPoint(figure1.right.x + figure2.size.w / 4,figure2.top.y - 10),
  48. new SKPoint(figure1.right.x + figure2.size.w / 4,figure2.top.y - 10),
  49. new SKPoint(figure2.top.x,figure2.top.y - 10),
  50. new SKPoint(figure2.top.x,figure2.top.y - 10),
  51. new SKPoint(figure2.top.x,figure2.top.y),
  52. };
  53. canvas.DrawPoints(SKPointMode.Lines, points, paint);
  54. }
  55. }
  56. }