コード例 #1
0
 private GpxRoute extractWayPoints(
     GpxType gpxType, boolean hasSpeedInMeterPerSecondInsteadOfKilometerPerHour) {
   String name = gpxType.getMetadata() != null ? gpxType.getMetadata().getName() : null;
   String desc = gpxType.getMetadata() != null ? gpxType.getMetadata().getDesc() : null;
   List<String> descriptions = asDescription(desc);
   List<GpxPosition> positions =
       extractWayPoints(gpxType.getWpt(), hasSpeedInMeterPerSecondInsteadOfKilometerPerHour);
   return positions.size() == 0
       ? null
       : new GpxRoute(this, Waypoints, name, descriptions, positions, gpxType);
 }
コード例 #2
0
  private MetadataType createMetaData(GpxRoute route, GpxType gpxType) {
    ObjectFactory objectFactory = new ObjectFactory();

    MetadataType metadataType = gpxType.getMetadata();
    if (metadataType == null) metadataType = objectFactory.createMetadataType();

    if (isWriteName()) {
      metadataType.setName(asRouteName(route.getName()));
      metadataType.setDesc(asDescription(route.getDescription()));
    }
    return metadataType;
  }