Beispiel #1
0
  public List<Way> getWays() {
    final List<Way> ws = new ArrayList<Way>();

    for (Segment s : segments) {
      ws.add(s.getWay());
    }

    return Collections.unmodifiableList(ws);
  }
Beispiel #2
0
  public double getLengthFrom(Way w) {
    double length = Double.NEGATIVE_INFINITY;

    for (Segment s : getSegments()) {
      length += s.getLength();

      if (w.equals(s.getWay())) {
        length = 0;
      }
    }

    if (length < 0) {
      throw new IllegalArgumentException("Way must be part of the route.");
    }

    return length;
  }