for (BaseNavigationPosition position : route.getPositions()) {
if (!position.hasCoordinates())
continue;
if (position.getDescription() != null) {
LongitudeAndLatitude lal = new LongitudeAndLatitude(position.getLongitude(), position.getLatitude());
if (comments.get(lal) == null) {
comments.put(lal, position.getDescription());
}
}
if (position.getElevation() != null) {
LongitudeAndLatitude lal = new LongitudeAndLatitude(position.getLongitude(), position.getLatitude());
if (elevations.get(lal) == null) {
elevations.put(lal, position.getElevation());
}
}
if (position.getSpeed() != null) {
LongitudeAndLatitude lal = new LongitudeAndLatitude(position.getLongitude(), position.getLatitude());
if (speeds.get(lal) == null) {
speeds.put(lal, position.getSpeed());
}
}
if (position.hasTime()) {
LongitudeAndLatitude lal = new LongitudeAndLatitude(position.getLongitude(), position.getLatitude());
if (times.get(lal) == null) {
times.put(lal, position.getTime());
}
}
}
}
for (BaseRoute<BaseNavigationPosition, BaseNavigationFormat> route : routes) {
for (BaseNavigationPosition position : route.getPositions()) {
if (!position.hasCoordinates())
continue;
if (position.getDescription() == null) {
LongitudeAndLatitude lal = new LongitudeAndLatitude(position.getLongitude(), position.getLatitude());
String comment = comments.get(lal);
if (comment != null) {
position.setDescription(comment);
}
}
if (position.getElevation() == null) {
LongitudeAndLatitude lal = new LongitudeAndLatitude(position.getLongitude(), position.getLatitude());
Double elevation = elevations.get(lal);
if (elevation != null) {
position.setElevation(elevation);
}
}
if (position.getSpeed() == null) {
LongitudeAndLatitude lal = new LongitudeAndLatitude(position.getLongitude(), position.getLatitude());
Double speed = speeds.get(lal);
if (speed != null) {
position.setSpeed(speed);
}
}
if (!position.hasTime()) {
LongitudeAndLatitude lal = new LongitudeAndLatitude(position.getLongitude(), position.getLatitude());
CompactCalendar time = times.get(lal);
if (time != null) {
position.setTime(time);
}
}