FlowLine.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. 
  2. using System.Drawing;
  3. namespace Dongke.IBOSS.Basics.FlowSetting
  4. {
  5. /// <summary>
  6. /// 线段
  7. /// </summary>
  8. public class FlowLine : FlowItem
  9. {
  10. #region 成员变量
  11. /// <summary>
  12. /// 起点坐标
  13. /// </summary>
  14. private Point _pointBegin = Point.Empty;
  15. /// <summary>
  16. /// 终点坐标
  17. /// </summary>
  18. private Point _pointEnd = Point.Empty;
  19. /// <summary>
  20. /// 线的颜色
  21. /// </summary>
  22. private Color _lineColor = Consts.LINE_COLOR_DEFAULT;
  23. /// <summary>
  24. /// 线宽
  25. /// </summary>
  26. private int _lineWidth = Consts.LINE_WIDTH_DEFAULT;
  27. /// <summary>
  28. /// 起始节点连接点
  29. /// </summary>
  30. private AnchorKind _anchorBegin = AnchorKind.None;
  31. /// <summary>
  32. /// 终止节点连接点
  33. /// </summary>
  34. private AnchorKind _anchorEnd = AnchorKind.None;
  35. /// <summary>
  36. /// 起始节点(不保存xml)
  37. /// </summary>
  38. private FlowNode _nodeBegin = null;
  39. /// <summary>
  40. /// 终止节点(不保存xml)
  41. /// </summary>
  42. private FlowNode _nodeEnd = null;
  43. /// <summary>
  44. /// 加载流程时使用,临时保存NodeCode,把line链接到node时利用。
  45. /// </summary>
  46. internal string NodeCodeBegin = null;
  47. /// <summary>
  48. /// 加载流程时使用,临时保存NodeCode,把line链接到node时利用。
  49. /// </summary>
  50. internal string NodeCodeEnd = null;
  51. #endregion 成员变量
  52. #region 构造函数
  53. /// <summary>
  54. /// 新线段
  55. /// </summary>
  56. /// <param name="manager">流程项目管理</param>
  57. internal FlowLine(ItemManager manager)
  58. : base(manager)
  59. {
  60. this.ShowName = false;
  61. this.Name = "连线" + this.ItemID;
  62. }
  63. /// <summary>
  64. /// 导入的线段
  65. /// </summary>
  66. /// <param name="manager">流程项目管理</param>
  67. /// <param name="itemID">项目ID</param>
  68. /// <param name="onlyCode">唯一编码</param>
  69. internal FlowLine(ItemManager manager, int itemID, string onlyCode)
  70. : base(manager, itemID, onlyCode)
  71. {
  72. this.ShowName = false;
  73. this.Name = "连线" + this.ItemID;
  74. }
  75. #endregion 构造函数
  76. #region 属性
  77. /// <summary>
  78. /// 起点坐标
  79. /// </summary>
  80. public Point PointBegin
  81. {
  82. get
  83. {
  84. return this._pointBegin;
  85. }
  86. set
  87. {
  88. this._pointBegin = value;
  89. }
  90. }
  91. /// <summary>
  92. /// 终点坐标
  93. /// </summary>
  94. public Point PointEnd
  95. {
  96. get
  97. {
  98. return this._pointEnd;
  99. }
  100. set
  101. {
  102. this._pointEnd = value;
  103. }
  104. }
  105. /// <summary>
  106. /// 线的颜色
  107. /// </summary>
  108. public Color LineColor
  109. {
  110. get
  111. {
  112. return this._lineColor;
  113. }
  114. set
  115. {
  116. this._lineColor = value;
  117. }
  118. }
  119. /// <summary>
  120. /// 线宽
  121. /// </summary>
  122. public int LineWidth
  123. {
  124. get
  125. {
  126. return this._lineWidth;
  127. }
  128. set
  129. {
  130. this._lineWidth = value < 1 ? 1 : value;
  131. }
  132. }
  133. /// <summary>
  134. /// 起始节点
  135. /// </summary>
  136. public FlowNode NodeBegin
  137. {
  138. get
  139. {
  140. return this._nodeBegin;
  141. }
  142. internal set
  143. {
  144. this._nodeBegin = value;
  145. }
  146. }
  147. /// <summary>
  148. /// 终止节点
  149. /// </summary>
  150. public FlowNode NodeEnd
  151. {
  152. get
  153. {
  154. return this._nodeEnd;
  155. }
  156. internal set
  157. {
  158. this._nodeEnd = value;
  159. }
  160. }
  161. /// <summary>
  162. /// 起始节点连接点
  163. /// </summary>
  164. public AnchorKind AnchorBegin
  165. {
  166. get
  167. {
  168. return this._anchorBegin;
  169. }
  170. internal set
  171. {
  172. this._anchorBegin = value;
  173. }
  174. }
  175. /// <summary>
  176. /// 终止节点连接点
  177. /// </summary>
  178. public AnchorKind AnchorEnd
  179. {
  180. get
  181. {
  182. return this._anchorEnd;
  183. }
  184. internal set
  185. {
  186. this._anchorEnd = value;
  187. }
  188. }
  189. #endregion 属性
  190. #region 公有方法
  191. /// <summary>
  192. /// 获取选择状态样式范围
  193. /// </summary>
  194. /// <returns>选择状态样式范围</returns>
  195. public override Rectangle[] GetSelectedStyle()
  196. {
  197. int styleSize = Consts.SELECTEDSTYLE_WIDTH;
  198. int styleSizeHalf = Consts.SELECTEDSTYLE_WIDTH_HALF;
  199. Rectangle[] rects = new Rectangle[2];
  200. rects[0] = new Rectangle(this.PointBegin.X - styleSizeHalf, this.PointBegin.Y - styleSizeHalf, styleSize, styleSize);
  201. rects[1] = new Rectangle(this.PointEnd.X - styleSizeHalf, this.PointEnd.Y - styleSizeHalf, styleSize, styleSize);
  202. return rects;
  203. }
  204. #endregion 公有方法
  205. }
  206. }