Ejemplo n.º 1
0
  private List<GpxRoute> extractRoutes(
      GpxType gpxType, boolean hasSpeedInMeterPerSecondInsteadOfKilometerPerHour) {
    List<GpxRoute> result = new ArrayList<GpxRoute>();

    for (RteType rteType : gpxType.getRte()) {
      String name = rteType.getName();
      String desc = rteType.getDesc();
      List<String> descriptions = asDescription(desc);
      List<GpxPosition> positions =
          extractRoute(rteType, hasSpeedInMeterPerSecondInsteadOfKilometerPerHour);
      result.add(new GpxRoute(this, Route, name, descriptions, positions, gpxType, rteType));

      // Garmin Extensions v3
      if (rteType.getExtensions() != null && rteType.getExtensions().getAny().size() > 0) {
        List<GpxPosition> extendedPositions =
            extractRouteWithGarminExtensions(
                rteType, hasSpeedInMeterPerSecondInsteadOfKilometerPerHour);
        result.add(
            new GpxRoute(this, Track, name, descriptions, extendedPositions, gpxType, rteType));
      }
    }

    return result;
  }