primitives.py 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. , fq, color,width, arrow_show,air_type):
  19. self.vec_list = vec_list
  20. self.air_type = air_type
  21. self.fq = fq
  22. self.arrow_show = arrow_show
  23. super().__init__(id_, layer_id, name, center,middle_line, width, color)
  24. class Tun3d(Entity):
  25. def __init__(self, id_, layer_id, name, center: Node,middle_line:Line, plg_l:Plg,plg_r:Plg,plg_b:Plg
  26. , fq, color,width, arrow_show,air_type):
  27. self.plg_r = plg_r
  28. self.plg_l = plg_l
  29. self.plg_b = plg_b
  30. self.air_type = air_type
  31. self.fq = fq
  32. self.arrow_show = arrow_show
  33. super().__init__(id_, layer_id, name, center,middle_line, width, color)
  34. class Window(Entity):
  35. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color):
  36. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  37. class Gate(Entity):
  38. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color):
  39. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  40. class Sealed(Entity):
  41. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color,from_tun_id):
  42. super().__init__(id_, layer_id, name, center, middle_line, width, color,from_tun_id)
  43. class WindBridge(Entity):
  44. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color):
  45. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  46. class TunText(Entity):
  47. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color,value):
  48. self.value = value
  49. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  50. class AirFlow(Entity):
  51. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color,air_type):
  52. self.air_type = air_type
  53. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  54. class Shaft(Entity):
  55. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color):
  56. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  57. class Fan(Entity):
  58. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color,fan_type):
  59. self.fan_type = fan_type
  60. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  61. class AirDuct(Entity):
  62. def __init__(self, id_, layer_id, name, center: Node, middle_line: Line, width, color,path_list:List[Line]):
  63. self.path_list = path_list
  64. super().__init__(id_, layer_id, name, center, middle_line, width, color)
  65. class TunGap:
  66. def __init__(self,plg:Plg,color=(0,0,0)):
  67. self.plg = plg
  68. self.color = color