primitives.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. from abc import ABC
  2. from typing import List
  3. import core
  4. from entity import Node
  5. from entity.Line import Line, Plg
  6. class Entity(ABC):
  7. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color, from_tun_id=None):
  8. self.id = id_
  9. self.from_tun_id = from_tun_id
  10. self.name = name
  11. self.layer_id = layer_id
  12. self.center = center
  13. self.width = width
  14. self.color = color
  15. self.middle_line = middle_line
  16. class Tun2d(Entity):
  17. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, vec_list: List[Line],
  18. layer_vec_list: List[Line]
  19. , fq, color, width, arrow_show, air_type):
  20. self.layer_vec_list = layer_vec_list
  21. self.vec_list = vec_list
  22. self.air_type = air_type
  23. self.fq = fq
  24. self.arrow_show = arrow_show
  25. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  26. class Tun3d(Entity):
  27. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, plg_l: Plg, plg_r: Plg, plg_b: Plg
  28. , fq, color, width, arrow_show, air_type):
  29. self.plg_r = plg_r
  30. self.plg_l = plg_l
  31. self.plg_b = plg_b
  32. self.air_type = air_type
  33. self.fq = fq
  34. self.arrow_show = arrow_show
  35. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  36. class Window(Entity):
  37. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color):
  38. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  39. class Gate(Entity):
  40. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color):
  41. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  42. class Sealed(Entity):
  43. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color, from_tun_id):
  44. super().__init__(id_, layer_id, name, center, middle_line, width, color, from_tun_id)
  45. class WindBridge(Entity):
  46. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color):
  47. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  48. class TunText(Entity):
  49. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color, value):
  50. self.value = value
  51. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  52. class AirFlow(Entity):
  53. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color, air_type):
  54. self.air_type = air_type
  55. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  56. class Shaft(Entity):
  57. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color):
  58. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  59. class Fan(Entity):
  60. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color, fan_type):
  61. self.fan_type = fan_type
  62. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  63. class AirDuct(Entity):
  64. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color, path_list: List[Line]):
  65. self.path_list = path_list
  66. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  67. class TunGap:
  68. def __init__(self, plg: Plg, color=(0, 0, 0)):
  69. self.plg = plg
  70. self.color = color
  71. class Drill:
  72. def __init__(self, id_, layer_id, line_list: List, color):
  73. self.id_ = id_
  74. self.layer_id = layer_id
  75. self.line_list = line_list
  76. self.color = color
  77. class Face:
  78. def __init__(self, layer_id, node_list: List, color):
  79. self.layer_id = layer_id
  80. self.node_list = node_list
  81. self.color = color
  82. class Empty:
  83. def __init__(self, layer_id, node_list: List, color):
  84. self.layer_id = layer_id
  85. self.node_list = node_list
  86. self.color = color