StelUtils.hpp   StelUtils.hpp 
skipping to change at line 27 skipping to change at line 27
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _STELUTILS_HPP_ #ifndef _STELUTILS_HPP_
#define _STELUTILS_HPP_ #define _STELUTILS_HPP_
#include "VecMath.hpp" #include "VecMath.hpp"
#include <QVariantMap> #include <QVariantMap>
#include <QDateTime> #include <QDateTime>
#include <QSize>
#include <QString> #include <QString>
// astonomical unit (km) // astonomical unit (km)
#define AU 149597870.691 #define AU 149597870.691
// Parsec (km) // Parsec (km)
#define PARSEC 30.857e12 #define PARSEC 30.857e12
// speed of light (km/sec) // speed of light (km/sec)
#define SPEED_OF_LIGHT 299792.458 #define SPEED_OF_LIGHT 299792.458
//! @namespace StelUtils contains general purpose utility functions. //! @namespace StelUtils contains general purpose utility functions.
skipping to change at line 97 skipping to change at line 98
//! @param useD Define if letter "d" must be used instead of deg sig n //! @param useD Define if letter "d" must be used instead of deg sig n
QString radToDmsStrAdapt(double angle, bool useD=false); QString radToDmsStrAdapt(double angle, bool useD=false);
//! Convert an angle in radian to a dms formatted string. //! Convert an angle in radian to a dms formatted string.
//! @param angle input angle in radian //! @param angle input angle in radian
//! @param useD Define if letter "d" must be used instead of deg sig n //! @param useD Define if letter "d" must be used instead of deg sig n
//! @param decimal output decimal second value //! @param decimal output decimal second value
QString radToDmsStr(double angle, bool decimal=false, bool useD=fals e); QString radToDmsStr(double angle, bool decimal=false, bool useD=fals e);
//! Convert a dms formatted string to an angle in radian //! Convert a dms formatted string to an angle in radian
//! @param dsm The input string //! @param s The input string
double dmsStrToRad(const QString& s); double dmsStrToRad(const QString& s);
//! Obtains a Vec3f from a string. //! Obtains a Vec3f from a string.
//! @param s the string describing the Vector with the form "x,y,z" //! @param s the string describing the Vector with the form "x,y,z"
//! @return The corresponding vector //! @return The corresponding vector
//! @deprecated Use the >> operator from Vec3f class //! @deprecated Use the >> operator from Vec3f class
Vec3f strToVec3f(const QStringList& s); Vec3f strToVec3f(const QStringList& s);
Vec3f strToVec3f(const QString& s); Vec3f strToVec3f(const QString& s);
//! Converts a Vec3f to HTML color notation. //! Converts a Vec3f to HTML color notation.
skipping to change at line 176 skipping to change at line 177
//! @return the angle in radians. //! @return the angle in radians.
//! Latitude: North are positive, South are negative. //! Latitude: North are positive, South are negative.
//! Longitude: East is positive, West is negative. //! Longitude: East is positive, West is negative.
//! Note: if there is a N, S, E or W suffix, any leading + or - //! Note: if there is a N, S, E or W suffix, any leading + or -
//! characters are ignored. //! characters are ignored.
double getDecAngle(const QString& str); double getDecAngle(const QString& str);
//! Check if a number is a power of 2. //! Check if a number is a power of 2.
bool isPowerOfTwo(int value); bool isPowerOfTwo(int value);
//! Return the first power of two bigger than the given value. //! Return the first power of two greater or equal to the given valu
int getBiggerPowerOfTwo(int value); e.
int smallestPowerOfTwoGreaterOrEqualTo(int value);
//! Return the smallest size with power-of two dimensions at least a
s large as given size.
QSize smallestPowerOfTwoSizeGreaterOrEqualTo(const QSize base);
//! Return the inverse sinus hyperbolic of z. //! Return the inverse sinus hyperbolic of z.
double asinh(double z); double asinh(double z);
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// New Qt based General Calendar Functions. // New Qt based General Calendar Functions.
//! Make from julianDay a year, month, day for the Julian Date julia nDay represents. //! Make from julianDay a year, month, day for the Julian Date julia nDay represents.
void getDateFromJulianDay(double julianDay, int *year, int *month, i nt *day); void getDateFromJulianDay(double julianDay, int *year, int *month, i nt *day);
//! Make from julianDay an hour, minute, second. //! Make from julianDay an hour, minute, second.
skipping to change at line 202 skipping to change at line 206
bool getDateTimeFromISO8601String(const QString& iso8601Date, int* y , int* m, int* d, int* h, int* min, float* s); bool getDateTimeFromISO8601String(const QString& iso8601Date, int* y , int* m, int* d, int* h, int* min, float* s);
//! Format the given Julian Day in (UTC) ISO8601 date string. //! Format the given Julian Day in (UTC) ISO8601 date string.
//! Also handles negative and distant years. //! Also handles negative and distant years.
QString julianDayToISO8601String(double jd); QString julianDayToISO8601String(double jd);
//! Return the Julian Date matching the ISO8601 date string. //! Return the Julian Date matching the ISO8601 date string.
//! Also handles negative and distant years. //! Also handles negative and distant years.
double getJulianDayFromISO8601String(const QString& iso8601Date, boo l* ok); double getJulianDayFromISO8601String(const QString& iso8601Date, boo l* ok);
//! Format the date and day-of-week per the format in fmt (see QDate //! Format the date and day-of-week per the format in fmt
Time::toString()). //! (see QDateTime::toString()). Uses the @b system locale, not
//! the one set in Stellarium.
//! @return QString representing the formatted date //! @return QString representing the formatted date
QString localeDateString(int year, int month, int day, int dayOfWeek , QString fmt); QString localeDateString(int year, int month, int day, int dayOfWeek , QString fmt);
//! Format the date and day-of-week per the default locale's QLocale //! Format the date and day-of-week per the @b system locale's
::ShortFormat. //! QLocale::ShortFormat.
//! @return QString representing the formatted date //! @return QString representing the formatted date
QString localeDateString(int year, int month, int day, int dayOfWeek ); QString localeDateString(int year, int month, int day, int dayOfWeek );
//! Get the current Julian Date from system time. //! Get the current Julian Date from system time.
//! @return the current Julian Date //! @return the current Julian Date
double getJDFromSystem(); double getJDFromSystem();
//! Convert a time of day to the fraction of a Julian Day. //! Convert a time of day to the fraction of a Julian Day.
//! Note that a Julian Day starts at 12:00, not 0:00, and //! Note that a Julian Day starts at 12:00, not 0:00, and
//! so 12:00 == 0.0 and 0:00 == 0.5 //! so 12:00 == 0.0 and 0:00 == 0.5
skipping to change at line 271 skipping to change at line 278
inline Vec3f getNightColor(const Vec3f& dayColor) inline Vec3f getNightColor(const Vec3f& dayColor)
{ {
float max = 0.0; float max = 0.0;
for(int i=0; i<3; i++) for(int i=0; i<3; i++)
{ {
max = dayColor[i] > max ? dayColor[i] : max; max = dayColor[i] > max ? dayColor[i] : max;
} }
return Vec3f(max, 0, 0); return Vec3f(max, 0, 0);
} }
//! Calculate and getting orbital period in days from semi-major axi //! Calculate and getting sidereal period in days from semi-major ax
s (in AU) is (in AU)
double calculateOrbitalPeriod(double SemiMajorAxis); double calculateSiderealPeriod(double SemiMajorAxis);
//! Calculate duration of mean solar day
double calculateSolarDay(double siderealPeriod, double siderealDay,
bool forwardDirection);
QString hoursToHmsStr(double hours);
//! Get the number of seconds since program start.
//!
//! @note This is implemented in platform-specific ways to be as pre
cise
//! as possible, but there is a fallback for other platforms t
hat
//! might not be precise at all.
//! This is currently used e.g. to measure FPS, but it should
never
//! be used for critical functionality.
long double secondsSinceStart();
//! Get Delta-T estimation for a given date.
//! Note that this method is valid for the year range:
//! -1999 to +3000, outside of which "0" will be returned.
//! @param jDay the date and time expressed as a julian day
//! @return Delta-T in seconds
double getDeltaT(double jDay);
//! Get Secular Acceleration estimation for a given year.
//! @param jDay the JD
//! @return SecularAcceleration in seconds
double getMoonSecularAcceleration(double jDay);
} }
#endif // _STELUTILS_HPP_ #endif // _STELUTILS_HPP_
 End of changes. 6 change blocks. 
10 lines changed or deleted 46 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/