[Kstars-devel] branches/kstars/summer/kstars/kstars

Prakash Mohan prak902000 at gmail.com
Sat May 9 14:39:38 CEST 2009


SVN commit 965585 by prakash:

Making a few modifications to class KSAlmanac. Changing the GeoLocation instance to GeoLocation *.
Also, ks->geo() was used instead of user specified geo. Fixing it.

CCMAIL: kstars-devel at kde.org


 M  +10 -7     ksalmanac.cpp  
 M  +1 -1      ksalmanac.h  


--- branches/kstars/summer/kstars/kstars/ksalmanac.cpp #965584:965585
@@ -28,6 +28,7 @@
 #include "ksnumbers.h"
 #include "dms.h"
 #include "skyobjects/skyobject.h"
+
 KSAlmanac* KSAlmanac::pinstance=NULL;
 
 KSAlmanac* KSAlmanac::Instance() {
@@ -39,6 +40,8 @@
     ks = KStars::Instance();
     dt = KStarsDateTime::currentDateTime();
     geo = ks->geo();
+	dt.setTime(QTime());
+	dt = geo->LTtoUT(dt);
     m_Sun = new KSSun;
     m_Moon = new KSMoon;
     SunRise=SunSet=MoonRise=MoonSet=0;
@@ -54,19 +57,19 @@
 void KSAlmanac::RiseSetTime( SkyObject *o, double *riseTime, double *setTime ) {
     //Compute Sun rise and set times
     const KStarsDateTime today = dt;
-    const GeoLocation _geo = geo;
+    const GeoLocation* _geo = geo;
 //    *riseTime = -1.0 * o->riseSetTime( today.djd() + 1.0, geo, true ).secsTo(QTime()) / 86400.0;
 //     *setTime = -1.0 * o->riseSetTime( today.djd(), geo, false ).secsTo(QTime()) / 86400.0;
-    *riseTime = -1.0 * o->riseSetTime( today, &_geo, true ).secsTo(QTime()) / 86400.0; 
-    *setTime = -1.0 * o->riseSetTime( today, &_geo, false ).secsTo(QTime()) / 86400.0;
+    *riseTime = -1.0 * o->riseSetTime( today, _geo, true ).secsTo(QTime()) / 86400.0; 
+    *setTime = -1.0 * o->riseSetTime( today, _geo, false ).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() );
     KSNumbers *oldNum = new KSNumbers( ks->data()->ut().djd() );
-    dms LST = ks->geo()->GSTtoLST( dt.gst() );
-    o->updateCoords( num, true, ks->geo()->lat(), &LST );
-    if ( o->checkCircumpolar( ks->geo()->lat() ) ) {
+    dms LST = geo->GSTtoLST( dt.gst() );
+    o->updateCoords( num, true, geo->lat(), &LST );
+    if ( o->checkCircumpolar( geo->lat() ) ) {
         if ( o->alt()->Degrees() > 0.0 ) {
             //Circumpolar, signal it this way:
             *riseTime = 0.0;
@@ -90,7 +93,7 @@
 }
 
 void KSAlmanac::setLocation( GeoLocation *m_geo ) {
-    geo = *m_geo;
+    geo = m_geo;
     update();
 }
 
--- branches/kstars/summer/kstars/kstars/ksalmanac.h #965584:965585
@@ -47,7 +47,7 @@
         KSMoon *m_Moon;
 		KStars *ks;
         KStarsDateTime dt;
-        GeoLocation geo;
+        GeoLocation *geo;
         double SunRise, SunSet, MoonRise, MoonSet, riseRate;
 };
 


More information about the Kstars-devel mailing list