[Kstars-devel] kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Fri Jan 2 18:13:46 CET 2004


CVS commit by harris: 

One more fix that I noticed while addressing the previous bug report fix:

In the WUT tool, the displayed Moon Illumination fraction did not change 
when changing the date inside the tool.  Fixed.

CCMAIL: kstars-devel at kde.org


  M +23 -21    wutdialog.cpp   1.22


--- kdeedu/kstars/kstars/wutdialog.cpp  #1.21:1.22
@@ -26,4 +26,6 @@
 #include "timedialog.h"
 #include "wutdialogui.h"
+#include "kssun.h"
+#include "ksmoon.h"
 
 #include <kcombobox.h>
@@ -115,8 +117,8 @@ void WUTDialog::init() {
 
         // sun almanac information
-        SkyObject *o = (SkyObject*) kstars->data()->PCat->planetSun();
-        sunRiseTomorrow = o->riseSetTime( JDTomorrow, geo, true );
-        sunSetToday = o->riseSetTime( JDToday, geo, false );
-        sunRiseToday = o->riseSetTime( JDToday, geo, true );
+        KSSun *oSun = (KSSun*) kstars->data()->PCat->planetSun();
+        sunRiseTomorrow = oSun->riseSetTime( JDTomorrow, geo, true );
+        sunSetToday = oSun->riseSetTime( JDToday, geo, false );
+        sunRiseToday = oSun->riseSetTime( JDToday, geo, true );
 
         //check to see if Sun is circumpolar
@@ -125,7 +127,7 @@ void WUTDialog::init() {
         dms LST = KSUtils::UTtoLST( KSUtils::JDtoUT( JDToday ), geo->lng() );
         
-        o->updateCoords( num, true, geo->lat(), &LST );
-        if ( o->checkCircumpolar( geo->lat() ) ) {
-                if ( o->alt()->Degrees() > 0.0 ) {
+        oSun->updateCoords( num, true, geo->lat(), &LST );
+        if ( oSun->checkCircumpolar( geo->lat() ) ) {
+                if ( oSun->alt()->Degrees() > 0.0 ) {
                         sRise = i18n( "circumpolar" );
                         sSet = i18n( "circumpolar" );
@@ -147,7 +149,4 @@ void WUTDialog::init() {
         }
 
-        //Restore Sun's coordinates
-        o->updateCoords( oldNum, true, geo->lat(), kstars->LST() );
-
         WUT->SunSetLabel->setText( i18n( "Sunset: %1" ).arg(sSet) );
         WUT->SunRiseLabel->setText( i18n( "Sunrise: %1" ).arg(sRise) );
@@ -155,14 +154,14 @@ void WUTDialog::init() {
 
         // moon almanac information
-        o = (SkyObject*) kstars->data()->Moon;
-        moonRise = o->riseSetTime( JDToday, geo, true );
-        moonSet = o->riseSetTime( JDToday, geo, false );
+        KSMoon *oMoon = (KSMoon*) kstars->data()->Moon;
+        moonRise = oMoon->riseSetTime( JDToday, geo, true );
+        moonSet = oMoon->riseSetTime( JDToday, geo, false );
         if ( moonSet < moonRise ) 
-                moonSet = o->riseSetTime( JDTomorrow, geo, false );
+                moonSet = oMoon->riseSetTime( JDTomorrow, geo, false );
 
         //check to see if Moon is circumpolar
-        o->updateCoords( num, true, geo->lat(), &LST );
-        if ( o->checkCircumpolar( geo->lat() ) ) {
-                if ( o->alt()->Degrees() > 0.0 ) {
+        oMoon->updateCoords( num, true, geo->lat(), &LST );
+        if ( oMoon->checkCircumpolar( geo->lat() ) ) {
+                if ( oMoon->alt()->Degrees() > 0.0 ) {
                         sRise = i18n( "circumpolar" );
                         sSet = i18n( "circumpolar" );
@@ -176,11 +175,14 @@ void WUTDialog::init() {
         }
 
-        //Restore Moon's coordinates
-        o->updateCoords( oldNum, true, geo->lat(), kstars->LST() );
-        
         WUT->MoonRiseLabel->setText( i18n( "Moon rises at: %1" ).arg( sRise ) );
         WUT->MoonSetLabel->setText( i18n( "Moon sets at: %1" ).arg( sSet ) );
+        oMoon->findPhase( oSun ); 
         WUT->MoonIllumLabel->setText( i18n( "Moon's Illumination fraction", "Moon illum.: %1%" ).arg(
-                        int(100.0*kstars->data()->Moon->illum() ) ) );
+                        int(100.0*oMoon->illum() ) ) );
+
+        //Restore Sun's and Moon's coordinates, and recompute Moon's original Phase
+        oMoon->updateCoords( oldNum, true, geo->lat(), kstars->LST() );
+        oSun->updateCoords( oldNum, true, geo->lat(), kstars->LST() );
+        oMoon->findPhase( oSun ); 
 
         splitObjectList();




More information about the Kstars-devel mailing list