Beispiel #1
0
 private List<GpxPosition> extractTrack(
     TrkType trkType, boolean hasSpeedInMeterPerSecondInsteadOfKilometerPerHour) {
   List<GpxPosition> positions = new ArrayList<GpxPosition>();
   if (trkType != null) {
     for (TrksegType trkSegType : trkType.getTrkseg()) {
       for (WptType wptType : trkSegType.getTrkpt()) {
         positions.add(
             new GpxPosition(
                 wptType.getLon(),
                 wptType.getLat(),
                 wptType.getEle(),
                 getSpeed(wptType, hasSpeedInMeterPerSecondInsteadOfKilometerPerHour),
                 getHeading(wptType),
                 parseTime(wptType.getTime()),
                 asComment(wptType.getName(), wptType.getDesc()),
                 wptType.getHdop(),
                 wptType.getPdop(),
                 wptType.getVdop(),
                 wptType.getSat(),
                 wptType));
       }
     }
   }
   return positions;
 }
Beispiel #2
0
 private List<TrkType> createTrack(GpxRoute route, int startIndex, int endIndex) {
   ObjectFactory objectFactory = new ObjectFactory();
   List<TrkType> trkTypes = new ArrayList<TrkType>();
   TrkType trkType = route.getOrigin(TrkType.class);
   if (trkType != null) trkType.getTrkseg().clear();
   else trkType = objectFactory.createTrkType();
   if (isWriteName()) {
     trkType.setName(asRouteName(route.getName()));
     trkType.setDesc(asDescription(route.getDescription()));
   }
   trkTypes.add(trkType);
   TrksegType trksegType = objectFactory.createTrksegType();
   List<GpxPosition> positions = route.getPositions();
   for (int i = startIndex; i < endIndex; i++) {
     GpxPosition position = positions.get(i);
     WptType wptType = createWptType(position);
     if (wptType != null) trksegType.getTrkpt().add(wptType);
   }
   trkType.getTrkseg().add(trksegType);
   return trkTypes;
 }