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); }
void DigitEntry::SetLongitude(Angle value, CoordinateFormat format) { // Longitude in floating point degrees value = value.AsDelta(); const auto degrees = fabs(value.Degrees()); // Check the first three columns here assert(columns[0].type == Column::Type::EAST_WEST); assert(columns[1].type == Column::Type::DIGIT19); assert(columns[2].type == Column::Type::DIGIT); columns[0].value = value.IsNegative(); // Set up and check the remaining digits SetDigits(degrees, format, false); Invalidate(); }
bool TurningLeft() const { return turn_rate_smoothed.IsNegative(); }