[Kstars-devel] branches/kstars/summer/kstars/kstars
Prakash Mohan
prak902000 at gmail.com
Sun May 10 10:15:14 CEST 2009
SVN commit 965972 by prakash:
Adding functions to return the Rise and Set times, in the QTime format also in class KSAlmanac.
CCMAIL: kstars-devel at kde.org
M +8 -5 ksalmanac.cpp
M +6 -1 ksalmanac.h
--- branches/kstars/summer/kstars/kstars/ksalmanac.cpp #965971:965972
@@ -50,15 +50,18 @@
}
void KSAlmanac::update() {
- RiseSetTime( (SkyObject*)m_Sun, &SunRise, &SunSet );
- RiseSetTime( (SkyObject*)m_Moon, &MoonRise, &MoonSet );
+ RiseSetTime( (SkyObject*)m_Sun, &SunRise, &SunSet, &SunRiseT, &SunSetT );
+ RiseSetTime( (SkyObject*)m_Moon, &MoonRise, &MoonSet, &MoonRiseT, &MoonSetT );
+ kDebug()<< SunRise <<" " << SunSet ;
}
-void KSAlmanac::RiseSetTime( SkyObject *o, double *riseTime, double *setTime ) {
+void KSAlmanac::RiseSetTime( SkyObject *o, double *riseTime, double *setTime, QTime *RiseTime, QTime *SetTime ) {
//Compute Sun rise and set times
const KStarsDateTime today = dt;
const GeoLocation* _geo = geo;
- *riseTime = -1.0 * o->riseSetTime( today.addDays(1), _geo, true ).secsTo(QTime()) / 86400.0;
- *setTime = -1.0 * o->riseSetTime( today, _geo, false ).secsTo(QTime()) / 86400.0;
+ *RiseTime = o->riseSetTime( today.addDays(1), _geo, true );
+ *SetTime = o->riseSetTime( today, _geo, false );
+ *riseTime = -1.0 * RiseTime->secsTo(QTime()) / 86400.0;
+ *setTime = -1.0 * SetTime->secsTo(QTime()) / 86400.0;
//check to see if Sun is circumpolar
//requires temporary repositioning of Sun to target date
KSNumbers *num = new KSNumbers( dt.djd() );
--- branches/kstars/summer/kstars/kstars/ksalmanac.h #965971:965972
@@ -27,7 +27,7 @@
#include "kstarsdata.h"
class KSAlmanac {
public:
- void RiseSetTime( SkyObject *o, double *riseTime, double *setTime );
+ void RiseSetTime( SkyObject *o, double *riseTime, double *setTime, QTime *RiseTime, QTime *SetTime );
void setDate( KStarsDateTime *newdt );
void setLocation( GeoLocation *m_geo );
static KSAlmanac* Instance();
@@ -35,6 +35,10 @@
inline double getSunSet() { return SunSet; }
inline double getMoonRise() { return MoonRise; }
inline double getMoonSet() { return MoonSet; }
+ inline QTime sunRise() { return SunRiseT; }
+ inline QTime sunSet() { return SunSetT; }
+ inline QTime moonRise() { return MoonRiseT; }
+ inline QTime moonSet() { return MoonSetT; }
double getAstroTwilight( bool begin = true );
double getNauticalTwilight( bool begin = true );
double getCivilTwilight( bool begin = true );
@@ -49,6 +53,7 @@
KStarsDateTime dt;
GeoLocation *geo;
double SunRise, SunSet, MoonRise, MoonSet, riseRate;
+ QTime SunRiseT, SunSetT, MoonRiseT, MoonSetT;
};
#endif
More information about the Kstars-devel
mailing list