[Kstars-devel] [kstars] kstars/skyobjects: Fix precession bug: Reset lastPrecessJD when star data is reinitialized

Akarsh Simha akarsh at kde.org
Tue May 3 08:19:44 UTC 2016


Git commit d605210d0b9a4f0487ba63f72bf8fa87a9b88c31 by Akarsh Simha.
Committed on 03/05/2016 at 08:14.
Pushed by asimha into branch 'master'.

Fix precession bug: Reset lastPrecessJD when star data is reinitialized

We now recompute precession corrections only if there has been a large
shift in time.

With dynamically loaded stars (DeepStarComponent), the star object is
recycled in memory to avoid the overhead of memory allocation and
construction. The new star data is re-initialized in a pre-existing
StarObject by calling StarObject::init() with the new data.

Since we added the lastPrecessJD much later, it has to be initialized
in StarObject::init(); otherwise, the catalog coordinates will not be
precessed when a previously existing StarObject is re-purposed for a
new star.

CCMAIL: kstars-devel at kde.org, mutlaqja at ikarustech.com

M  +3    -0    kstars/skyobjects/starobject.cpp

http://commits.kde.org/kstars/d605210d0b9a4f0487ba63f72bf8fa87a9b88c31

diff --git a/kstars/skyobjects/starobject.cpp b/kstars/skyobjects/starobject.cpp
index 8d3bbb0..1683999 100644
--- a/kstars/skyobjects/starobject.cpp
+++ b/kstars/skyobjects/starobject.cpp
@@ -29,6 +29,7 @@
 #include "kspopupmenu.h"
 #include "ksnumbers.h"
 #include "kstarsdata.h"
+#include "kstarsdatetime.h"
 #include "Options.h"
 #include "skymap.h"
 #include "ksutils.h"
@@ -181,6 +182,7 @@ void StarObject::init( const starData *stardata )
     */
     // END DEBUG.
 
+    lastPrecessJD = J2000;
 
 }
 
@@ -225,6 +227,7 @@ void StarObject::init( const deepStarData *stardata )
     updateID = updateNumID = 0;
     B = stardata->B / 1000.0;
     V = stardata->V / 1000.0;
+    lastPrecessJD = J2000;
 }
 
 void StarObject::setNames( QString name, QString name2 ) {


More information about the Kstars-devel mailing list