RPoint.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using Newtonsoft.Json;
  2. using Prism.Mvvm;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Collections.ObjectModel;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using TeamAAS_VP.Enums;
  10. namespace TeamAAS_VP.Models
  11. {
  12. /// <summary>
  13. /// 机器人点位
  14. /// </summary>
  15. public class RPoint : BindableBase
  16. {
  17. private int _Number;
  18. /// <summary>
  19. /// 点编号
  20. /// </summary>
  21. public int Number
  22. {
  23. get { return _Number; }
  24. set { SetProperty(ref _Number, value); }
  25. }
  26. private string _Label;
  27. /// <summary>
  28. /// 点位标签
  29. /// </summary>
  30. public string Label
  31. {
  32. get { return _Label; }
  33. set { SetProperty(ref _Label, value); }
  34. }
  35. private float _X;
  36. public float X
  37. {
  38. get { return _X; }
  39. set { SetProperty(ref _X, value); }
  40. }
  41. private float _Y;
  42. public float Y
  43. {
  44. get { return _Y; }
  45. set { SetProperty(ref _Y, value); }
  46. }
  47. private float _Z;
  48. public float Z
  49. {
  50. get { return _Z; }
  51. set { SetProperty(ref _Z, value); }
  52. }
  53. private float _U;
  54. public float U
  55. {
  56. get { return _U; }
  57. set { SetProperty(ref _U, value); }
  58. }
  59. private float _V;
  60. public float V
  61. {
  62. get { return _V; }
  63. set { SetProperty(ref _V, value); }
  64. }
  65. private float _W;
  66. public float W
  67. {
  68. get { return _W; }
  69. set { SetProperty(ref _W, value); }
  70. }
  71. private RobotHand _Hand;
  72. public RobotHand Hand
  73. {
  74. get { return _Hand; }
  75. set { SetProperty(ref _Hand, value); }
  76. }
  77. private int _Local;
  78. public int Local
  79. {
  80. get { return _Local; }
  81. set { SetProperty(ref _Local, value); }
  82. }
  83. private int _Tool;
  84. public int Tool
  85. {
  86. get { return _Tool; }
  87. set { SetProperty(ref _Tool, value); }
  88. }
  89. private string _Description;
  90. /// <summary>
  91. /// 描述
  92. /// </summary>
  93. public string Description
  94. {
  95. get { return _Description; }
  96. set { SetProperty(ref _Description, value); }
  97. }
  98. public RPoint()
  99. {
  100. Number = 0;
  101. Label = "";
  102. X = 0;
  103. Y = 0;
  104. Z = 0;
  105. U = 0;
  106. V = 0;
  107. W = 0;
  108. Local = 0;
  109. Tool = 0;
  110. Hand = RobotHand.Right;
  111. Description = "";
  112. }
  113. public RPoint(int number,string label, float x, float y, float z, float u, float v, float w, int local, int tool, RobotHand hand, string description = "")
  114. {
  115. Number = number;
  116. Label = label;
  117. X = x;
  118. Y = y;
  119. Z = z;
  120. U = u;
  121. V = v;
  122. W = w;
  123. Local = local;
  124. Tool = tool;
  125. Hand = hand;
  126. Description = description;
  127. }
  128. public RPoint(int number)
  129. {
  130. Number = number;
  131. Label = "";
  132. X = 0;
  133. Y = 0;
  134. Z = 0;
  135. U = 0;
  136. V = 0;
  137. W = 0;
  138. Local = 0;
  139. Tool = 0;
  140. Hand = RobotHand.Right;
  141. Description = "";
  142. }
  143. public override bool Equals(object obj)
  144. {
  145. if (obj != null && obj is RPoint && ((RPoint)obj).Number == this.Number && ((RPoint)obj).Label == this.Label && ((RPoint)obj).Description == this.Description && ((RPoint)obj).X == this.X && ((RPoint)obj).Y == this.Y && ((RPoint)obj).Z == this.Z && ((RPoint)obj).U == this.U && ((RPoint)obj).V == this.V && ((RPoint)obj).W == this.W && ((RPoint)obj).Local == this.Local)
  146. {
  147. return true;
  148. }
  149. else { return false; }
  150. }
  151. public override int GetHashCode()
  152. {
  153. return base.GetHashCode();
  154. }
  155. public override string ToString()
  156. {
  157. return $"{Number},{Label},{X:F3},{Y:F3},{Z:F3},{U:F3},{V:F3},{W:F3},{Local},{Tool},{Hand}";
  158. }
  159. public RPoint Clone()
  160. {
  161. return new RPoint(this.Number, this.Label, this.X, this.Y, this.Z, this.U, this.V, this.W, this.Local, this.Tool, this.Hand, this.Description);
  162. }
  163. }
  164. }