Funktion zur Findung von Sensor Aufpunkten auf Racks implementiert. Dazu unittest.
This commit is contained in:
+30
-22
@@ -18,12 +18,12 @@ def graphbuild(d_racks_segments, d_rack_conn_points):
|
||||
G.add_node(end) # Knoten für Endpunkt
|
||||
G.add_edge(start, end) # Kante zwischen Start und Endpunkt
|
||||
|
||||
# 4. Verbindungen aus d_rack_conn_points hinzufügen
|
||||
for connection, points in d_rack_conn_points.items():
|
||||
for point in points:
|
||||
# Wir fügen die Kante zwischen den Punkten der Verbindung hinzu
|
||||
# Hinweis: Wir nehmen hier an, dass der Punkt von beiden Racks als Verbindungspunkt betrachtet wird
|
||||
G.add_edge(point, point) # Verbindungspunkt als Kante
|
||||
# # 4. Verbindungen aus d_rack_conn_points hinzufügen
|
||||
# for connection, points in d_rack_conn_points.items():
|
||||
|
||||
# # Wir fügen die Kante zwischen den Punkten der Verbindung hinzu
|
||||
# # Hinweis: Wir nehmen hier an, dass der Punkt von beiden Racks als Verbindungspunkt betrachtet wird
|
||||
# G.add_edge(point, point) # Verbindungspunkt als Kante
|
||||
|
||||
|
||||
|
||||
@@ -41,13 +41,13 @@ class TestShapely(unittest.TestCase):
|
||||
}
|
||||
|
||||
d_rack_conn_points = {
|
||||
'Rack_2-0 + Rack_2-1': [Point(0.1, 3777.6)],
|
||||
'Rack_2-1 + Rack_1-0': [Point(4946.5, 3777.6)],
|
||||
'Rack_2-1 + Rack_4-0': [Point(2866.6, 3777.6)],
|
||||
'Rack_2-1 + Rack_5-0': [Point(8866.1, 3777.6)],
|
||||
'Rack_3-0 + Rack_1-0': [Point(4946.5, 15865.5)],
|
||||
'Rack_3-0 + Rack_4-0': [Point(2866.6, 15865.5)],
|
||||
'Rack_3-0 + Rack_5-0': [Point(8866.1, 15865.5)]
|
||||
'Rack_2-0 + Rack_2-1': Point(0.1, 3777.6),
|
||||
'Rack_2-1 + Rack_1-0': Point(4946.5, 3777.6),
|
||||
'Rack_2-1 + Rack_4-0': Point(2866.6, 3777.6),
|
||||
'Rack_2-1 + Rack_5-0': Point(8866.1, 3777.6),
|
||||
'Rack_3-0 + Rack_1-0': Point(4946.5, 15865.5),
|
||||
'Rack_3-0 + Rack_4-0': Point(2866.6, 15865.5),
|
||||
'Rack_3-0 + Rack_5-0': Point(8866.1, 15865.5)
|
||||
}
|
||||
|
||||
G = graphbuild(d_racks_segments, d_rack_conn_points)
|
||||
@@ -70,18 +70,25 @@ class TestShapely(unittest.TestCase):
|
||||
|
||||
nodes = G.nodes
|
||||
|
||||
|
||||
|
||||
self.assertEqual(str(G.nodes), nodes_str)
|
||||
self.assertEqual(str(G.edges), edges_str)
|
||||
|
||||
allids = NodeIDs(nodes)
|
||||
ids = allids.get_ids(nodes)
|
||||
for k,v in d_racks_segments.items():
|
||||
allids.add_points(v)
|
||||
|
||||
for k,v in d_rack_conn_points.items():
|
||||
allids.add_point(v)
|
||||
|
||||
|
||||
#ids = allids.get_ids(nodes)
|
||||
|
||||
#cords = allids.get_points(ids)
|
||||
|
||||
|
||||
self.assertEqual(len(ids), len(nodes))
|
||||
|
||||
# self.assertEqual(len(ids), len(nodes))
|
||||
|
||||
|
||||
# self.assertEqual(cords,nodes_str)
|
||||
|
||||
# self.assertEqual(allids.get_point(1), Point(4946.5, 15865.5))
|
||||
|
||||
|
||||
# 6. Optional: Visualisierung des Graphen
|
||||
@@ -92,7 +99,8 @@ class TestShapely(unittest.TestCase):
|
||||
#nx.draw(G, pos, with_labels=False, node_size=10, font_size=8)
|
||||
#plt.show()
|
||||
|
||||
|
||||
def test_easy(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user