Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace connected_nodes with connected_edges #40

Open
8 tasks done
Tracked by #296
antonykamp opened this issue Apr 13, 2023 · 0 comments · May be fixed by #42
Open
8 tasks done
Tracked by #296

Replace connected_nodes with connected_edges #40

antonykamp opened this issue Apr 13, 2023 · 0 comments · May be fixed by #42

Comments

@antonykamp
Copy link

antonykamp commented Apr 13, 2023

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

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_nodes with function and @property decorator
  • Add connected_edge_on_left, connected_edge_on_right and connected_edge_on_head property with type Edge
  • Use connected_edge_on_left, connected_edge_on_right and connected_edge_on_head in set_connection_left, set_connection_right, set_connection_head.
  • Use connected_edges in set_connection_left, set_connection_right and set_connection_head
  • Replace connected_on_left, connected_on_right and connected_on_head with function and @property decorator
  • Add function to Edge given a top node of the edge, get the opposite one.
  • Add function to Edge given a top node of the edge, get the nearest geo node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant