[Kstars-devel] branches/kstars/summer/kstars/kstars
Prakash Mohan
prak902000 at gmail.com
Sat May 9 23:29:00 CEST 2009
SVN commit 965820 by prakash:
Implementing KSAlmanac class to get rise and set times in SkyCalendar.
CCMAIL: kstars-devel at kde.org
M +0 -1 ksalmanac.cpp
M +11 -4 tools/calendarwidget.cpp
--- branches/kstars/summer/kstars/kstars/ksalmanac.cpp #965819:965820
@@ -52,7 +52,6 @@
void KSAlmanac::update() {
RiseSetTime( (SkyObject*)m_Sun, &SunRise, &SunSet );
RiseSetTime( (SkyObject*)m_Moon, &MoonRise, &MoonSet );
- kDebug()<< SunRise<<" "<<SunSet;
}
void KSAlmanac::RiseSetTime( SkyObject *o, double *riseTime, double *setTime ) {
//Compute Sun rise and set times
--- branches/kstars/summer/kstars/kstars/tools/calendarwidget.cpp #965819:965820
@@ -24,6 +24,7 @@
#include "kstarsdata.h"
#include "skyobjects/kssun.h"
#include "skycalendar.h"
+#include "ksalmanac.h"
#define XPADDING 20
#define YPADDING 20
@@ -73,15 +74,21 @@
QPolygonF polySunRise;
QPolygonF polySunSet;
-
+ KSAlmanac *ksal =KSAlmanac::Instance() ;
//Add points along curved edge of horizon polygons
int imonth = -1;
float rTime, sTime;
while ( y == kdt.date().year() ) {
float t = float( kdt.date().daysInYear() - kdt.date().dayOfYear() );
- rTime = sun->riseSetTime( kdt.djd() + 1.0, data->geo(), true, true ).secsTo(QTime())*-24.0/86400.0;
- sTime = sun->riseSetTime( kdt.djd(), data->geo(), false, true ).secsTo(QTime())*-24.0/86400.0 - 24.0;
-
+ ksal->setDate(&kdt);
+ ksal->setLocation(data->geo());
+ rTime = ksal->getSunRise()*24.0;
+ sTime = ksal->getSunSet()*24.0 -24.0;
+// kDebug()<<rTime<<" "<<sTime;
+// rTime = sun->riseSetTime( kdt.djd() + 1.0, data->geo(), true, true ).secsTo(QTime())*-24.0/86400.0;
+// sTime = sun->riseSetTime( kdt.djd(), data->geo(), false, true ).secsTo(QTime())*-24.0/86400.0 - 24.0;
+// kDebug()<<rTime<<" "<<sTime;
+// FIXME why do the above two give different values ? ( Difference < 1 min though )
if ( kdt.date().month() != imonth ) {
riseTimeList.append( rTime );
setTimeList.append( sTime );
More information about the Kstars-devel
mailing list