String fromid = ((Connection)o).getFrom().getID();
String toid = ((Connection)o).getTo().getID();
RouteRenderingInformation ri = (RouteRenderingInformation) ((Connection)o).getRenderingInformation();
Direction lastD = null;
Dimension2D lastP= null;
for (int i = 0; i < ri.size(); i++) {
Dimension2D pos = ri.getWaypoint(i);
if (ri.isHop(i)) {
crosses ++;
}
Direction currentD = null;
if (lastP!=null) {
if (pos.getWidth() > lastP.getWidth()) {
currentD = Direction.RIGHT;
} else if (pos.getWidth() < lastP.getWidth()) {
currentD = Direction.LEFT;
} else {
if (pos.getHeight() < lastP.getHeight()) {
currentD = Direction.UP;
} else if (pos.getHeight() > lastP.getHeight()){
currentD = Direction.DOWN;
} else {
currentD = lastD;
}
}
distance += Math.abs(pos.getWidth() - lastP.getWidth()) + Math.abs(pos.getHeight() - lastP.getHeight());
}
if ((lastD != null) && (lastD!=currentD)) {
turns ++;
}