TwoPointRelation.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /////////////////////////////////////////////
  2. //Copyright (c) 2011, 北京探索者软件公司
  3. //All rights reserved.
  4. //文件名称:
  5. //文件描述:
  6. //创 建 者: mjy
  7. //创建日期: 2011-11-02
  8. //版 本 号:4.0.0.0
  9. /////////////////////////////////////////////
  10. using System.Drawing;
  11. namespace SAGA.DotNetUtils.Geometry
  12. {
  13. public class TwoPointRelation
  14. {
  15. private PointF fix;
  16. private PointF other;
  17. public TwoPointRelation(PointF fix, PointF other)
  18. {
  19. this.fix = fix;
  20. this.other = other;
  21. }
  22. public RelationOptions RelationGraphics
  23. {
  24. get
  25. {
  26. if (other.X >= fix.X)
  27. {
  28. if (other.Y >= fix.Y)
  29. return RelationOptions.RightDown;
  30. return RelationOptions.RightUp;
  31. }
  32. else
  33. {
  34. if (other.Y >= fix.Y)
  35. return RelationOptions.LeftDown;
  36. return RelationOptions.LeftUp;
  37. }
  38. }
  39. }
  40. public RelationOptions RelationCAD
  41. {
  42. get
  43. {
  44. if (other.X >= fix.X)
  45. {
  46. if (other.Y >= fix.Y)
  47. return RelationOptions.RightUp;
  48. return RelationOptions.RightDown;
  49. }
  50. else
  51. {
  52. if (other.Y >= fix.Y)
  53. return RelationOptions.LeftUp;
  54. return RelationOptions.LeftDown;
  55. }
  56. }
  57. }
  58. }
  59. }