[Kstars-devel] kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Sun Jan 4 23:48:03 CET 2004


CVS commit by harris: 

Fixing bug in the AltVsTime tool that Pablo pointed out: the altitude 
curves of custom objects did not update when changing the date/location.

Also, I noticed the Epoch box was not being used to set the epoch for new 
custom objects.  Now, if the box is not blank when adding a custom object, 
the coordinates will be precessed from the entered epoch to J2000.  Thus, 
it assumes that a blank epoch means J2000 (perhaps we should instead 
assume the epoch of the tool's current date?  any opinions?)

CCMAIL: kstars-devel at kde.org


  M +22 -1     altvstime.cpp   1.11


--- kdeedu/kstars/kstars/altvstime.cpp  #1.10:1.11
@@ -136,4 +136,14 @@ void AltVsTime::slotAddSource(void) {
                 if ( ok ) newDec = avtUI->decBox->createDms( true, &ok );
 
+                //If the epochName is blank (or any non-double), we assume J2000
+                //Otherwise, precess to J2000.
+                double jd = epochToJd( getEpoch( avtUI->epochName->text() ) );
+                if ( jd != J2000 ) {
+                        SkyPoint ptest( newRA, newDec );
+                        ptest.precessFromAnyEpoch( jd, J2000 );
+                        newRA.setH( ptest.ra()->Hours() );
+                        newDec.setD( ptest.dec()->Degrees() );
+                }
+
                 //make sure the coords do not already exist from another object
                 bool found(false);
@@ -360,4 +370,5 @@ void AltVsTime::slotUpdateDateLoc(void) 
         KSNumbers *num = new KSNumbers( computeJdFromCalendar() );
         KSNumbers *oldNum = 0;
+        dms LST = KSUtils::UTtoLST( KSUtils::JDtoUT( computeJdFromCalendar() ), geo->lng() );
         
         //First determine time of sunset and sunrise
@@ -377,5 +388,5 @@ void AltVsTime::slotUpdateDateLoc(void) 
                                 if ( o->isSolarSystem() ) {
                                         oldNum = new KSNumbers( ks->data()->clock()->JD() );
-                                        o->updateCoords( num, true, geo->lat(), ks->LST() );
+                                        o->updateCoords( num, true, geo->lat(), &LST );
                                 }
 
@@ -403,4 +414,14 @@ void AltVsTime::slotUpdateDateLoc(void) 
                         }
                 }
+                
+                if ( ! objFound ) {  //assume unfound object is a custom object
+                        pList.at(i)->updateCoords( num ); //precess to desired epoch
+
+                        KPlotObject *po = new KPlotObject( "", "white", KPlotObject::CURVE, 1, KPlotObject::SOLID );
+                        for ( double h=-12.0; h<=12.0; h+=0.5 ) {
+                                po->addPoint( new DPoint( h, findAltitude( pList.at(i), h ) ) );
+                        }
+                        View->replaceObject( i, po );
+                }
         }
 




More information about the Kstars-devel mailing list