StelUtils.cpp   StelUtils.cpp 
skipping to change at line 98 skipping to change at line 98
break; break;
case QSysInfo::WV_WINDOWS7: case QSysInfo::WV_WINDOWS7:
OS = "Windows 7"; OS = "Windows 7";
break; break;
#ifdef WV_WINDOWS8 #ifdef WV_WINDOWS8
case QSysInfo::WV_WINDOWS8: case QSysInfo::WV_WINDOWS8:
OS = "Windows 8"; OS = "Windows 8";
break; break;
#endif #endif
#ifdef WV_WINDOWS8_1 #ifdef WV_WINDOWS8_1
case QSysInfo::WV_WINDOWS8_1 case QSysInfo::WV_WINDOWS8_1:
OS = "Windows 8.1"; OS = "Windows 8.1";
break; break;
#endif #endif
#ifdef WV_WINDOWS10
case QSysInfo::WV_WINDOWS10:
OS = "Windows 10";
break;
#endif
default: default:
OS = "Unsupported Windows version"; OS = "Unsupported Windows version";
break; break;
} }
// somebody writing something useful for Macs would be great here // somebody writing something useful for Macs would be great here
#elif defined Q_OS_MAC #elif defined Q_OS_MAC
switch(QSysInfo::MacintoshVersion) switch(QSysInfo::MacintoshVersion)
{ {
case QSysInfo::MV_PANTHER: case QSysInfo::MV_PANTHER:
skipping to change at line 133 skipping to change at line 138
case QSysInfo::MV_LION: case QSysInfo::MV_LION:
OS = "Mac OS X 10.7 series"; OS = "Mac OS X 10.7 series";
break; break;
case QSysInfo::MV_MOUNTAINLION: case QSysInfo::MV_MOUNTAINLION:
OS = "Mac OS X 10.8 series"; OS = "Mac OS X 10.8 series";
break; break;
case QSysInfo::MV_MAVERICKS: case QSysInfo::MV_MAVERICKS:
OS = "Mac OS X 10.9 series"; OS = "Mac OS X 10.9 series";
break; break;
#ifdef MV_YOSEMITE #ifdef MV_YOSEMITE
case QSysInfo::MV_YOSEMITE case QSysInfo::MV_YOSEMITE:
OS = "Mac OS X 10.10 series"; OS = "Mac OS X 10.10 series";
break; break;
#endif #endif
default: default:
OS = "Unsupported Mac version"; OS = "Unsupported Mac version";
break; break;
} }
#elif defined Q_OS_LINUX #elif defined Q_OS_LINUX
QFile procVersion("/proc/version"); QFile procVersion("/proc/version");
skipping to change at line 225 skipping to change at line 230
s = 0.; s = 0.;
m += 1; m += 1;
} }
if (m==60) if (m==60)
{ {
m = 0.; m = 0.;
d += 1; d += 1;
} }
} }
void radToDecDeg(double rad, bool &sign, double &deg)
{
rad = std::fmod(rad,2.0*M_PI);
sign=true;
if (rad<0)
{
rad *= -1;
sign = false;
}
deg = rad*180./M_PI;
}
QString radToDecDegStr(const double angle, const bool useD, const bool useC
)
{
QChar degsign('d');
QString str;
if (!useD)
{
degsign = 0x00B0;
}
bool sign;
double deg;
StelUtils::radToDecDeg(angle, sign, deg);
str = QString("%1%2%3").arg((sign?"+":"-"), QString::number(deg, 'f'
, 4), degsign);
if (useC)
{
if (!sign)
deg = 360. - deg;
str = QString("+%1%2").arg(QString::number(deg, 'f', 4), deg
sign);
}
return str;
}
/************************************************************************* /*************************************************************************
Convert an angle in radian to a hms formatted string Convert an angle in radian to a hms formatted string
If the minute and second part are null are too small, don't print them If the minute and second part are null are too small, don't print them
*************************************************************************/ *************************************************************************/
QString radToHmsStrAdapt(const double angle) QString radToHmsStrAdapt(const double angle)
{ {
unsigned int h,m; unsigned int h,m;
double s; double s;
QString buf; QString buf;
QTextStream ts(&buf); QTextStream ts(&buf);
skipping to change at line 372 skipping to change at line 412
else else
{ {
os << qSetRealNumberPrecision(0); os << qSetRealNumberPrecision(0);
width = 2; width = 2;
} }
os << fixed << qSetFieldWidth(width) << qSetPadChar('0') << s << qSe tFieldWidth(0) << '\"'; os << fixed << qSetFieldWidth(width) << qSetPadChar('0') << s << qSe tFieldWidth(0) << '\"';
return str; return str;
} }
void decDegToDms(double angle, bool &sign, unsigned int &d, unsigned int &m
, double &s)
{
sign = true;
if (angle<0.)
{
sign = false;
angle *= -1;
}
d = (unsigned int)angle;
m = (unsigned int)((angle-d)*60);
s = (angle-d)*3600.-60.*m;
if (s==60.)
{
s = 0.;
m += 1;
}
if (m==60)
{
m = 0;
d += 1;
}
}
// Convert an angle in decimal degrees to a dms formatted string
QString decDegToDmsStr(const double angle)
{
bool sign;
double s;
unsigned int d, m;
decDegToDms(angle, sign, d, m, s);
return QString("%1%2%3%4\'%5\"").arg(sign?'+':'-').arg(d).arg(QChar(
0x00B0)).arg(m,2,10,QLatin1Char('0')).arg((unsigned int)s,2,10,QLatin1Char(
'0'));
}
// Convert a dms formatted string to an angle in radian // Convert a dms formatted string to an angle in radian
double dmsStrToRad(const QString& s) double dmsStrToRad(const QString& s)
{ {
QRegExp reg("([\\+\\-])(\\d+)d(\\d+)'(\\d+)\""); QRegExp reg("([\\+\\-])(\\d+)d(\\d+)'(\\d+)\"");
if (!reg.exactMatch(s)) if (!reg.exactMatch(s))
return 0; return 0;
QStringList list = reg.capturedTexts(); QStringList list = reg.capturedTexts();
bool sign = (list[1] == "+"); bool sign = (list[1] == "+");
int deg = list[2].toInt(); int deg = list[2].toInt();
int min = list[3].toInt(); int min = list[3].toInt();
 End of changes. 5 change blocks. 
2 lines changed or deleted 83 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/