[Kstars-devel] kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Wed Dec 31 23:17:45 CET 2003


CVS commit by harris: 

Fixing bug #71520 ("Strange behavior of What's up tonight").  Problem 
traced to the fact that planet positions were not recomputed when user 
changed the Date inside the tool.  In order to fix, I am using the 
SkyObject::computeCoordsForJD() function.  I also had to make this 
function public.

Incidental fix:  wutdialog.cpp had code that was meant to always exclude 
the Sun from the list of visible objects, but the code only worked for 
English, because it compared the translated name to the untranslated name.  
In addition, the same code also excluded the Moon.  However, the Moon 
should NOT be excluded like this, so I removed that part.

(note that part 3 of this bug report, regarding the date format displayed 
in WUT, was found to be invalid).

Thank you for the detailed bug reports!

CCMAIL: kstars-devel at kde.org
CCMAIL: 71520-done at bugs.kde.org


  M +8 -9      skyobject.h   1.33
  M +6 -6      wutdialog.cpp   1.19


--- kdeedu/kstars/kstars/skyobject.h  #1.32:1.33
@@ -207,4 +207,12 @@ public:
         bool checkCircumpolar( const dms *gLng );
 
+/**The coordinates for the object on date "jd" are computed and returned,
+        *but the object's internal coordinates are not permanently modified.
+        *@return the coordinates of the selected object for the time given by jd
+        *@param jd0 Julian day for which the coords will be recomputed.
+        *@param geo pointer to geographic location (used for solar system only)
+        */
+        SkyPoint computeCoordsForJD( long double jd, const GeoLocation *geo=0 );
+
         QStringList ImageList, ImageTitle;
         QStringList InfoList, InfoTitle;
@@ -272,13 +280,4 @@ private:
         long double newJDfromJDandUT(long double jd, QTime UT);
 
-/**This function is only used internally, to calculate rise/set times.
-        *The coordinates for the object on date "jd" are computed and returned,
-        *but the object's internal coordinates are not permanently modified.
-        *@return the coordinates of the selected object for the time given by jd
-        *@param jd0 Julian day for which the coords will be recomputed.
-        *@param geo pointer to geographic location (used for solar system only)
-        */
-        SkyPoint computeCoordsForJD( long double jd, const GeoLocation *geo=0 );
-
         unsigned char Type;
         float Magnitude;

--- kdeedu/kstars/kstars/wutdialog.cpp  #1.18:1.19
@@ -216,8 +216,7 @@ void WUTDialog::slotLoadList(int i) {
                 bool visible = true;
                 if (lists.initialized[i] == false) {
-                        visible = checkVisibility(oname);
-                        // don't show the sun or moon
-                        if (i == 0) {
-                                if (oname->text() == "Sun" || oname->text() == "Moon" ) visible = false;
+                        if (i == 0) {  //planets, sun and moon
+                                if (oname->skyObject()->name() == "Sun" ) visible = false;  // don't ever display the sun
+                                else visible = checkVisibility(oname);
                         }
                         if (visible == false) {
@@ -248,5 +247,4 @@ bool WUTDialog::checkVisibility(SkyObjec
         bool visible( false );
         double minAlt = 20.0; //minimum altitude for object to be considered 'visible'
-        SkyPoint sp = (SkyPoint)*(oname->skyObject()); //local copy of skyObject's position
 
         //Initial values for T1, T2 assume all night option of EveningMorningBox
@@ -270,5 +268,7 @@ bool WUTDialog::checkVisibility(SkyObjec
                 //Need LST of the test time, expressed as a dms object.
                 QDateTime ut = test.addSecs( int( -3600*geo->TZ() ) );
+                long double jd = KSUtils::UTtoJD( ut );
                 dms LST = KSUtils::UTtoLST( ut, geo->lng() );
+                SkyPoint sp = oname->skyObject()->computeCoordsForJD( jd, geo );
 
                 //check altitude of object at this time.




More information about the Kstars-devel mailing list