|
@@ -132,6 +132,54 @@ class FloorGraph:
|
|
|
print("Next loop:",connector.source_id)
|
|
|
return self.system_graphs
|
|
|
|
|
|
+
|
|
|
+ def combine_single_model(self):
|
|
|
+ '''
|
|
|
+ 将一层内, 计算连接在一起的构建合并成一个分块
|
|
|
+ :return:
|
|
|
+ '''
|
|
|
+ arr_tmp = []
|
|
|
+ for systemgraph in self.system_graphs:
|
|
|
+ set1 = set()
|
|
|
+ for edge in systemgraph.system_edges:
|
|
|
+ set1.add(str(edge.start_vertex))
|
|
|
+ set1.add(str(edge.end_vertex))
|
|
|
+ arr_tmp.append(set1)
|
|
|
+ # for idx1 in range(0, len(arr_tmp)):
|
|
|
+ # for idx2 in range(idx1 + 1, len(arr_tmp)):
|
|
|
+ # tmp_set = set.intersection(arr_tmp[idx1], arr_tmp[idx2])
|
|
|
+ # if len(tmp_set) > 0:
|
|
|
+ # arr_tmp[idx1].union(arr_tmp[idx2])
|
|
|
+ # edges1 = self.system_graphs[idx1].system_edges
|
|
|
+ # edges2 = self.system_graphs[idx2].system_edges
|
|
|
+ # edges1.append(edges2)
|
|
|
+ # # self.system_graphs.remove(idx2)
|
|
|
+ # del self.system_graphs[idx2]
|
|
|
+ # # arr_tmp.remove(arr_tmp[idx2])
|
|
|
+ # del arr_tmp[idx2]
|
|
|
+ idx1 = 0
|
|
|
+ while idx1 < len(arr_tmp):
|
|
|
+ merged = False
|
|
|
+ idx2 = idx1 + 1
|
|
|
+ while idx2 < len(arr_tmp):
|
|
|
+ tmp_set = set.intersection(arr_tmp[idx1], arr_tmp[idx2])
|
|
|
+ if len(tmp_set) > 0:
|
|
|
+ arr_tmp[idx1] = arr_tmp[idx1].union(arr_tmp[idx2])
|
|
|
+ edges1 = self.system_graphs[idx1].system_edges
|
|
|
+ edges2 = self.system_graphs[idx2].system_edges
|
|
|
+ edges1.extend(edges2)
|
|
|
+ # self.system_graphs.remove(idx2)
|
|
|
+ del self.system_graphs[idx2]
|
|
|
+ # arr_tmp.remove(arr_tmp[idx2])
|
|
|
+ del arr_tmp[idx2]
|
|
|
+ merged = True
|
|
|
+ break
|
|
|
+ idx2 = idx2 + 1
|
|
|
+ if not merged :
|
|
|
+ idx1 = idx1 + 1
|
|
|
+
|
|
|
+ return self.system_graphs
|
|
|
+
|
|
|
def get_path(self, connector, system_graph, graph_next_connectors):
|
|
|
"""
|
|
|
Get Graph_Edge start with connector,end with triple ,cross,equipment.
|
|
@@ -308,19 +356,42 @@ def combine_systemgraph(project_id,floorgraphs):
|
|
|
v2 = open_vertical_pipes[j]
|
|
|
if systemutils.is_xyz_equal(v1.connector.origin, v2.connector.origin):
|
|
|
group_pipes.append(v2)
|
|
|
+
|
|
|
+ # 获取竖管连接的其他楼层竖管
|
|
|
+ if len(group_pipes) < 2:
|
|
|
+ continue
|
|
|
+ for k in range(len(group_pipes)):
|
|
|
+ vertex = group_pipes[k]
|
|
|
+ # systemgraph = systemutils.get_specify_type_parent(vertex, graph_model.SystemGraph)
|
|
|
+ systemgraph = systemutils.get_system_graph_by_vertex(vertex)
|
|
|
+ if not systemgraph:
|
|
|
+ continue
|
|
|
+ if (k == 0):
|
|
|
+ temp_groupedsystemgraphs = graph_model.GroupedSystemGraph(systemgraph)
|
|
|
+ else:
|
|
|
+ prev_vertex = group_pipes[k - 1]
|
|
|
+ temp_groupedsystemgraphs.add_system(systemgraph)
|
|
|
+ temp_groupedsystemgraphs.add_edge(prev_vertex, vertex)
|
|
|
+ if temp_groupedsystemgraphs:
|
|
|
+ projectgraph.groupedsystemgraphs.append(temp_groupedsystemgraphs)
|
|
|
+
|
|
|
+ for floorgraph in floorgraphs:
|
|
|
+ for systemgraph in floorgraph.system_graphs:
|
|
|
+ temp_groupedsystemgraphs = graph_model.GroupedSystemGraph(systemgraph)
|
|
|
+ projectgraph.groupedsystemgraphs.append(temp_groupedsystemgraphs)
|
|
|
# combine systemgraph
|
|
|
- for k in range(len(group_pipes)):
|
|
|
- vertex = group_pipes[k]
|
|
|
- systemgraph = systemutils.get_specify_type_parent(vertex, graph_model.SystemGraph)
|
|
|
- if not systemgraph:
|
|
|
- continue
|
|
|
- projectgraph.remove_groupedsystemgraphs(systemgraph)
|
|
|
- if (k == 0):
|
|
|
- temp_groupedsystemgraphs = graph_model.GroupedSystemGraph(systemgraph)
|
|
|
- else:
|
|
|
- prev_vertex = group_pipes[k - 1]
|
|
|
- temp_groupedsystemgraphs.add_system(systemgraph)
|
|
|
- temp_groupedsystemgraphs.add_edge(prev_vertex, vertex)
|
|
|
- if temp_groupedsystemgraphs:
|
|
|
- projectgraph.groupedsystemgraphs.append(temp_groupedsystemgraphs)
|
|
|
+ # for k in range(len(group_pipes)):
|
|
|
+ # vertex = group_pipes[k]
|
|
|
+ # systemgraph = systemutils.get_specify_type_parent(vertex, graph_model.SystemGraph)
|
|
|
+ # if not systemgraph:
|
|
|
+ # continue
|
|
|
+ # projectgraph.remove_groupedsystemgraphs(systemgraph)
|
|
|
+ # if (k == 0):
|
|
|
+ # temp_groupedsystemgraphs = graph_model.GroupedSystemGraph(systemgraph)
|
|
|
+ # else:
|
|
|
+ # prev_vertex = group_pipes[k - 1]
|
|
|
+ # temp_groupedsystemgraphs.add_system(systemgraph)
|
|
|
+ # temp_groupedsystemgraphs.add_edge(prev_vertex, vertex)
|
|
|
+ # if temp_groupedsystemgraphs:
|
|
|
+ # projectgraph.groupedsystemgraphs.append(temp_groupedsystemgraphs)
|
|
|
return projectgraph
|