IMI::AngleConverter::AngleConverter(Angle angle) { sign = (angle.Sign() == -1) ? 1 : 0; double mag(angle.AbsoluteDegrees()); degrees = static_cast<IMIDWORD> (mag); milliminutes = static_cast<IMIDWORD> ((mag - degrees) * 60 * 1000); }
static void FormatLongitude(char *buffer, size_t buffer_size, Angle longitude) { // Calculate Longitude sign char sign = longitude.IsNegative() ? 'W' : 'E'; double mlong(longitude.AbsoluteDegrees()); int dd = (int)mlong; // Calculate minutes double mins = (mlong - dd) * 60.0; // Save the string to the buffer snprintf(buffer, buffer_size, "%02d%06.3f,%c", dd, mins, sign); }
static void FormatLatitude(char *buffer, size_t buffer_size, Angle latitude ) { // Calculate Latitude sign char sign = negative(latitude.Native()) ? 'S' : 'N'; double mlat(latitude.AbsoluteDegrees()); int dd = (int)mlat; // Calculate minutes double mins = (mlat - dd) * 60.0; // Save the string to the buffer snprintf(buffer, buffer_size, "%02d%06.3f,%c", dd, mins, sign); }