Skip to content

Replace connected_nodes with connected_edges #40

Open
@antonykamp

Description

@antonykamp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions