Browse Source

mxg:添加注释

mengxiangge 5 years ago
parent
commit
b757c65e0e
2 changed files with 16 additions and 6 deletions
  1. 11 5
      src/system_relation/graph_model.py
  2. 5 1
      src/system_relation/systemutils.py

+ 11 - 5
src/system_relation/graph_model.py

@@ -45,7 +45,11 @@ class SystemEdge:
 	flow_direction = 0
 
 	def __init__(self,parent, system_data):
+		# 边上经过(使用)的构件(JoinObject类型的弯头,变径, Pipe, Duct)
+		# 起点和终点是一个多通, 设备(完整的管子)
+		# 起点是多通或设备, 终点是构件(JoinObject类型的弯头,变径, Pipe, Duct) (不完整的管子)
 		self.system_data = system_data
+		# 所属的系统
 		self.parent = parent
 
 	def get_vertexs(self):
@@ -74,9 +78,9 @@ class SystemGraph:
 	def add_edge(self, c1, c2, elements):
 		"""
 		Create edge and add to system_edges list
-		:param c1:
-		:param c2:
-		:param elements:
+		:param c1:  出发连接点
+		:param c2:  结束连接点
+		:param elements: 途径对象
 		:return:
 		"""
 		edge = SystemEdge(self,elements)
@@ -97,7 +101,7 @@ class SystemGraph:
 					open_pipes.append(vertex)
 		return open_pipes
 
-
+# 一层中的最终分块
 class FloorGraph:
 	"""FLoor Graph.
 	May contain one or more SystemGraph.
@@ -114,7 +118,7 @@ class FloorGraph:
 		self.system_graphs = []
 
 	def get_floor_graphs(self):
-		"""Get current floor graph.
+		"""Get current floor graph.(一个楼层的分块)
 		system_name,domain
 		"""
 		for connector in self.connector_data:
@@ -157,6 +161,7 @@ class FloorGraph:
 					next_element = self.get_element(next_connector.belong)
 					edge_elements.append(next_element)
 					other_connectors = self.get_other_connectors(next_connector)
+					# 终止条件:遇到设备或部件或遇到多通或堵头(join_object)
 					if systemutils.is_break_condition(next_element) or len(other_connectors) != 1:
 						print(next_connector.source_id)
 						next_connector.is_used = True
@@ -242,6 +247,7 @@ class GroupedSystemGraph:
 		edge.end_vertex=vertex2
 		self.connectedges.append(edge)
 
+# 全部楼层合并后的分块
 class ProjectGraph:
 	'''
 	ProjectGraph contain more than one GroupedSystemGraph.

+ 5 - 1
src/system_relation/systemutils.py

@@ -103,7 +103,11 @@ def is_xyz_equal(origin1, origin2):
 	v2 = [origin2.X, origin2.Y, origin2.Z]
 	return vg.almost_equal(v1, v2, atol=1e-08)
 
-
+# 父子结构
+# FloorGraph  楼层
+# 	SystemGraph  楼层下分块
+# 		SystemEdge  分块内边
+# 			SystemVertex  边上两端的顶点(连接点)
 def get_specify_type_parent(vertex, type):
 	parent = vertex
 	try: