/** Returns the distance in KM. */
public float getTravelDistance() {
float result = 0f;
int size = Math.abs(toIndex-fromIndex)+1;
List<MapNode> nodes = way.getNodes();
Position pos = new Position(nodes.get(fromIndex));
for (int i = 1; i < size; i++) {
MapNode next =
nodes.get(fromIndex < toIndex ? fromIndex+i : fromIndex-i);
result+= pos.getDistKM(next);
pos = new Position(next);
}
return result;
}