positionT.setLatitudeDegrees(position.getLatitude());
return positionT;
}
private CourseLapT createCourseLap(TcxRoute route, int startIndex, int endIndex) {
CourseLapT courseLapT = new ObjectFactory().createCourseLapT();
Wgs84Position first = route.getPositionCount() >= startIndex ? route.getPosition(startIndex) : null;
Wgs84Position last = route.getPositionCount() >= endIndex ? route.getPosition(endIndex - 1) : null;
if (last == null)
last = first;
courseLapT.setAverageHeartRateBpm(getHeartBeatRateT(first));
courseLapT.setDistanceMeters(route.getDistance());
courseLapT.setIntensity(IntensityT.fromValue("Active"));
courseLapT.setTotalTimeSeconds(route.getTime() / 1000.0);
if (first != null) {
courseLapT.setBeginPosition(createPosition(first));
if (first.getElevation() != null)
courseLapT.setBeginAltitudeMeters(first.getElevation());
}
if (last != null) {
courseLapT.setEndPosition(createPosition(last));
if (last.getElevation() != null)
courseLapT.setEndAltitudeMeters(last.getElevation());
}
return courseLapT;
}