Take a more OO approach to handling the d3 data

I'm wondering whether getTargetEndpoint and getSourceEndpoint make conceptual sense given that routes might go in either direction so ``this.routes[0]`` could easily be the other way round for bidirectional connections. Not necessary to sort this out in this PR, just flagging it for attention.