// Check if we have to move to other side of the earth
if (dlat > LAT_RANGE || dlat < -LAT_RANGE) {
dlon = normalize(dlon - LON_RANGE, LON_RANGE);
dlat = normalize((LAT_RANGE * 2.0D) - dlat, LAT_RANGE);
}
lon = new Measurement(dlon, lon.getError(), lon.getUnit(), lon.getTime());
lat = new Measurement(dlat, lat.getError(), lat.getUnit(), lat.getTime());
}
/*
* Normalize track to be a value such that: 0 <= value < +2PI. This
* corresponds to 0 deg to +360 deg. 0 is North, 0.5PI is East, PI is
* South, 1.5PI is West
*/
normalizeTrack: {
if (track == null) {
break normalizeTrack;
}
double dtrack = track.getValue();
if ((0.0D <= dtrack) && (dtrack < TRACK_RANGE)) {
break normalizeTrack; /* value is already normalized */
}
dtrack %= TRACK_RANGE;
if (dtrack < 0.0D) {
dtrack += TRACK_RANGE;
}
track = new Measurement(dtrack, track.getError(), track.getUnit(), track.getTime());
}
this.latitude = lat;
this.longitude = lon;
this.altitude = alt;