[Kstars-devel] KDE/kdeedu/kstars/kstars

Akarsh Simha akarshsimha at gmail.com
Fri Dec 11 01:36:58 CET 2009


SVN commit 1061208 by asimha:

+ Make KSAlmanac::RiseSetTime private - it changes the SkyObject's
  coordinates!

+ Remove incorrect "restoration" of coordinates in
  KSAlmanac::RiseSetTime

+ Sanitize commens in KSAlmanac::RiseSetTime

CCMAIL: kstars-devel at kde.org



 M  +8 -8      ksalmanac.cpp  
 M  +7 -7      ksalmanac.h  


--- trunk/KDE/kdeedu/kstars/kstars/ksalmanac.cpp #1061207:1061208
@@ -51,18 +51,20 @@
 }
 
 void KSAlmanac::RiseSetTime( SkyObject *o, double *riseTime, double *setTime, QTime *RiseTime, QTime *SetTime ) {
-    //Compute Sun rise and set times
-    KStarsData* data = KStarsData::Instance();
+    // Compute object rise and set times
     const KStarsDateTime today = dt;
     const GeoLocation* _geo = geo;
-    *RiseTime = o->riseSetTime( today.addDays(1), _geo, true );
+    *RiseTime = o->riseSetTime( today.addDays(1), _geo, true ); // The addDays(1) gives the future rise time rather than past
     *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
+
+    // Check to see if the object is circumpolar
+    // NOTE: Since we are working on a local copy of the Sun / Moon,
+    //       we freely change the geolocation / time without setting
+    //       them back.
+
     KSNumbers num( dt.djd() );
-    KSNumbers oldNum( data->ut().djd() );
     dms LST = geo->GSTtoLST( dt.gst() );
     o->updateCoords( &num, true, geo->lat(), &LST );
     if ( o->checkCircumpolar( geo->lat() ) ) {
@@ -76,8 +78,6 @@
             *setTime = -1.0;
         }
     }
-    o->updateCoords( &oldNum, true, data->geo()->lat(), data->lst() );
-    o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
 }
 
 void KSAlmanac::setDate( KStarsDateTime *newdt ) {
--- trunk/KDE/kdeedu/kstars/kstars/ksalmanac.h #1061207:1061208
@@ -45,12 +45,6 @@
     KSAlmanac(); 
 
     /**
-     * This function computes the rise and set time for the given SkyObject. This is done in order to 
-     * have a common function for the computation of the Sun and Moon rise and set times.
-     */
-    void RiseSetTime( SkyObject *o, double *riseTime, double *setTime, QTime *RiseTime, QTime *SetTime );
-
-    /**
      *@short Set the date for computations to the given date
      *@param The new date to set as a KStarsDateTime
      */
@@ -86,7 +80,13 @@
     
 private:
     void update();
-    
+
+   /**
+     * This function computes the rise and set time for the given SkyObject. This is done in order to 
+     * have a common function for the computation of the Sun and Moon rise and set times.
+     */
+    void RiseSetTime( SkyObject *o, double *riseTime, double *setTime, QTime *RiseTime, QTime *SetTime ); 
+   
     KSSun  m_Sun;
     KSMoon m_Moon;
     KStarsDateTime dt;


More information about the Kstars-devel mailing list