00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STELUTILS_HPP_
00021 #define _STELUTILS_HPP_
00022
00023 #include "VecMath.hpp"
00024 #include "fixx11h.h"
00025
00026 #include <QVariantMap>
00027 #include <QDateTime>
00028 #include <QString>
00029
00030
00031 #define AU 149597870.691
00032
00033 #define PARSEC 30.857e12
00034
00035 #define SPEED_OF_LIGHT 299792.458
00036
00038 namespace StelUtils
00039 {
00040
00046 double hmsToRad(unsigned int h, unsigned int m, double s);
00047
00053 double dmsToRad(int d, unsigned int m, double s);
00054
00060 void radToHms(double rad, unsigned int& h, unsigned int& m, double& s);
00061
00068 void radToDms(double rad, bool& sign, unsigned int& d, unsigned int& m, double& s);
00069
00073 QString radToHmsStrAdapt(double angle);
00074
00078 QString radToHmsStr(double angle, bool decimal=false);
00079
00084 QString radToDmsStrAdapt(double angle, bool useD=false);
00085
00090 QString radToDmsStr(double angle, bool decimal=false, bool useD=false);
00091
00096 Vec3f strToVec3f(const QStringList& s);
00097 Vec3f strToVec3f(const QString& s);
00098
00102 QString vec3fToHtmlColor(const Vec3f& v);
00103
00106 Vec3f htmlColorToVec3f(const QString& c);
00107
00112 void spheToRect(double lng, double lat, Vec3d& v);
00113
00118 void spheToRect(float lng, float lat, Vec3f& v);
00119
00124 void rectToSphe(double *lng, double *lat, const Vec3d& v);
00125
00130 void rectToSphe(float *lng, float *lat, const Vec3d& v);
00131
00152 double getDecAngle(const QString& str);
00153
00155 bool isPowerOfTwo(int value);
00156
00158 int getBiggerPowerOfTwo(int value);
00159
00161 double asinh(double z);
00162
00164
00166 void getDateFromJulianDay(double julianDay, int *year, int *month, int *day);
00167
00169 void getTimeFromJulianDay(double julianDay, int *hour, int *minute, int *second);
00170
00172 QString sixIntsToIsoString( int year, int month, int day, int hour, int minute, int second );
00173
00174 QString jdToIsoString(double jd);
00175
00178 QString localeDateString(int year, int month, int day, int dayOfWeek, QString fmt);
00179
00182 QString localeDateString(int year, int month, int day, int dayOfWeek);
00183
00186 double getJDFromSystem(void);
00187
00191 double qTimeToJDFraction(const QTime& time);
00192
00194 QTime jdFractionToQTime(const double jd);
00195
00197 float getGMTShiftFromQT(double JD);
00198
00202 double qDateTimeToJd(const QDateTime& dateTime);
00203
00207 QDateTime jdToQDateTime(const double& jd);
00208
00209 bool getJDFromDate(double* newjd, int y, int m, int d, int h, int min, int s);
00210
00211 int numberOfDaysInMonthInYear(int month, int year);
00212 bool changeDateTimeForRollover(int oy, int om, int od, int oh, int omin, int os,
00213 int* ry, int* rm, int* rd, int* rh, int* rmin, int* rs);
00214
00216 void debugQVariantMap(const QVariant& m, const QString& indent="", const QString& key="");
00217
00219 QList<int> getIntsFromISO8601String(const QString& iso8601Date);
00220 }
00221
00222 #endif // _STELUTILS_HPP_