GeometryLocation.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:GeometryLocation
  3. * 作者:xulisong
  4. * 创建时间: 2019/6/19 16:43:58
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using System;
  8. using System.Collections.Generic;
  9. namespace JBIM.Definition
  10. {
  11. /// <summary>
  12. /// 定位类型
  13. /// </summary>
  14. public enum LocationType
  15. {
  16. Point=0,
  17. Line,
  18. Arc,
  19. Common
  20. }
  21. public class GeometryLocation
  22. {
  23. public GeometryLocation(LocationType type)
  24. {
  25. Type = type;
  26. Points = new List<XYZ>();
  27. }
  28. public LocationType Type { get; set; }
  29. public List<XYZ> Points { get;private set; }
  30. public static GeometryLocation CreatePointLocation(XYZ xyz)
  31. {
  32. if (xyz == null) return null;
  33. var result = new GeometryLocation(LocationType.Point);
  34. try
  35. {
  36. result.Points.Add(xyz);
  37. }
  38. catch (Exception e)
  39. {
  40. Console.WriteLine(e);
  41. }
  42. return result;
  43. }
  44. public static GeometryLocation CreateLineLocation(List<XYZ> xyzes)
  45. {
  46. var result = new GeometryLocation(LocationType.Line);
  47. result.Points.AddRange(xyzes);
  48. return result;
  49. }
  50. public static GeometryLocation CreateArcLocation(List<XYZ> xyzes)
  51. {
  52. var result = new GeometryLocation(LocationType.Arc);
  53. result.Points.AddRange(xyzes);
  54. return result;
  55. }
  56. }
  57. }