-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Suggested refactoring
Add to the class Nodes the property connected_edges containing the connected edges. This will replace the property connected_nodes. To keep reading access of connected_nodes somehow, calculate the connected nodes based on the connected_edges and use a @property decorator.
Do the same with connected_on_left, connected_on_right and connected_on_head and set_connection_left, set_connection_right and set_connection_head.
Therefore, every writing access of connected_edges and call of set_connection_left, set_connection_right, and set_connection_head has to be refactored.
Affected repositories are
- https://github.com/simulate-digital-rail/orm-importer
- https://github.com/simulate-digital-rail/planpro-importer
- https://github.com/simulate-digital-rail/cli-importer
- https://github.com/simulate-digital-rail/interlocking-exporter
- https://github.com/simulate-digital-rail/track-signal-generator
Advantage of refactoring
With this refactoring, we can identify "Abstellgleise", because we have two different connected edges instead of the same connected node.
Additionally, we can improve calc_anschluss_of_all_nodes. Currently, this function calculates the angles between three edges with their top nodes. This leads to failures if the edge is very long and straight.
Acceptance criterion
- Add
connected_edges - Replace
connected_nodeswith function and@propertydecorator - Add
connected_edge_on_left,connected_edge_on_rightandconnected_edge_on_headproperty with type Edge - Use
connected_edge_on_left,connected_edge_on_rightandconnected_edge_on_headinset_connection_left,set_connection_right,set_connection_head. - Use
connected_edgesinset_connection_left,set_connection_rightandset_connection_head - Replace
connected_on_left,connected_on_rightandconnected_on_headwith function and@propertydecorator - Add function to
Edgegiven a top node of the edge, get the opposite one. - Add function to
Edgegiven a top node of the edge, get the nearest geo node