| 1783 | // a signed latitude value in degrees and minutes. |
| 1784 | |
| 1785 | char *SzAltitude(real deg) |
| 1786 | { |
| 1787 | static char szAlt[15]; |
| 1788 | int d, m, f; |
| 1789 | real s; |
| 1790 | |
| 1791 | f = deg < 0.0; |
| 1792 | deg = RAbs(deg); |
| 1793 | if (us.nDegForm != df360) { |
| 1794 | if (us.fRound) |
| 1795 | deg = Mod(deg + |
| 1796 | VSeconds(rRound/60.0, rRound/3600.0, rRound/3600.0/1000.0)); |
| 1797 | d = (int)deg; |
| 1798 | m = (int)(RFract(deg)*60.0); |
| 1799 | sprintf(szAlt, "%c%2d%c%02d'", f ? '-' : '+', d, ChDeg(), m); |
| 1800 | if (us.fSeconds) { |
| 1801 | s = RFract(deg)*60.0; s = RFract(s)*60.0; |
| 1802 | sprintf(&szAlt[7], "%02d\"", (int)s); |
| 1803 | if (us.fSecond1K) { |
| 1804 | s = RFract(s)*1000.0; |
| 1805 | sprintf(&szAlt[9], ".%03d\"", (int)s); |
| 1806 | } |
| 1807 | } |
| 1808 | } else { |
| 1809 | s = RAbs(deg); |
| 1810 | if (!us.fSeconds) |
| 1811 | sprintf(szAlt, s < 10.0 ? "%c%1.4f" : "%c%2.3f", f ? '-' : '+', s); |
| 1812 | else if (!us.fSecond1K) |
| 1813 | sprintf(szAlt, s < 10.0 ? "%c%1.7f" : "%c%2.6f", f ? '-' : '+', s); |
| 1814 | else |
| 1815 | sprintf(szAlt, s < 10.0 ? "%c%1.11f" : "%c%2.10f", f ? '-' : '+', s); |
| 1816 | } |
| 1817 | return szAlt; |
| 1818 | } |
| 1819 | |
| 1820 | |
| 1821 | // Here return a string simply expressing the given value as degrees and |
no test coverage detected